The minimum and maximum of Integer types include a decimal point or use scientific E notation.
See original GitHub issueHi. While building my Swagger instance from scratch, I import JSON Schemas using the syntax:
Model model = io.swagger.util.Json.mapper().readValue(jsonSchemaFile, Model.class);
I then create BodyParameters and Response objects and set these model instances on them.
I then serialize my Swagger instance to JSON using the following syntax.
Json.pretty().writeValue(swaggerFile, swagger);
The first problem I’m running into is that my Integer type minimum and maximum facets gain a decimal point (from somewhere).
Before (in JSON Schema file):
"AccountCount":{
"type":"integer",
"maximum":9,
"minimum":0
},
After (in Swagger file):
"AccountCount" : {
"type" : "integer",
"minimum" : 0.0,
"maximum" : 9.0
},
The second issue I’m hitting is with decimal types where the bounds no longer come out right, and Swagger Editor complains about the use of scientific E notation for minimum and maximum.
Before (in JSON Schema file):
"Balance":{
"type":"number",
"format":"decimal",
"multipleOf":0.01,
"maximum":9999999999999999.99,
"minimum":-9999999999999999.99
}
After (in Swagger file):
"Balance" : {
"type" : "number",
"format" : "decimal",
"minimum" : -1.0E16,
"maximum" : 1.0E16
}
Here’s another peculiar one where an Integer is expressed using scientific E notation.
Before (in JSON Schema file):
"AccID":{
"type":"integer",
"maximum":2147483647,
"minimum":-2147483648
},
After (in Swagger file):
"AccID" : {
"type" : "integer",
"minimum" : -2.147483648E9,
"maximum" : 2.147483647E9
},
I’ve attached the JSON Schemas and the serialized swagger doc. Thanks for any help!
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
I uplifted swagger-core to 1.5.11, but I still see the minimum and maximum values as decimals. Am I missing something here?
Hi. I changed Double to BigDecimal for the minimum and maximum facets of numerics in the relevant classes (AbstractNumericProperty, DecimalProperty.setExample, PropertyDeserializer) and configured the Json.mapper() with mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS). With these changes the original decimal quantity that describes my minimum and maximum survive from deserialization of the JSON schema all the way to serialization of the Swagger model. I would like to commit the changes for review if that’s OK.