myhaiting commented on issue #4637:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/4637#issuecomment-2547767759

   > https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers 
OpenAPI 数据类型只有 number和integer,无法涵盖 BigInteger和BigDecimal。 如果要支持估计只能采用String类型表示。
   
   我临时修改是这样,不是很规范,但能正常工作:
   
https://github.com/apache/servicecomb-java-chassis/blob/f46b97e96d209a9f3bb5bb9ab4097e5e05ea910b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java#L386-L409
   
   改成:
   ```java
   return (cls != String.class
           && cls != Date.class
           && cls != LocalDate.class
           && cls != LocalDateTime.class
           && cls != BigDecimal.class
           && cls != byte[].class
           && cls != File.class
           && 
!cls.getName().equals("org.springframework.web.multipart.MultipartFile")
           && !Part.class.isAssignableFrom(cls));
   ```
   
https://github.com/apache/servicecomb-java-chassis/blob/f46b97e96d209a9f3bb5bb9ab4097e5e05ea910b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/converter/ConverterMgr.java#L62-L86
   
   加了一行
   ```java
   TYPE_FORMAT_MAP.put(genTypeFormatKey("number", ""),
               TypeFactory.defaultInstance().constructType(BigDecimal.class));
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to