Hello, we're hitting an error when trying to read a JSON schema which has a number property with minimum/maximum set to 9.999999999999999999999999999999999E6144 into a Model.class. We are using implementation group: 'io.swagger', name: 'swagger-core', version: '1.6.14' with Java 11, but hit similar issues at 8 or 17.
Exception in thread "main" java.lang.IllegalArgumentException: Character " is neither a decimal digit number, decimal point, nor "e" notation exponential mark. (through reference chain: io.swagger.models.ModelImpl["properties"]->java.util.LinkedHashMap["exampleNumber"])
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4624)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:4555)
at io.swagger.util.ModelDeserializer.deserialize(ModelDeserializer.java:63)
at io.swagger.util.ModelDeserializer.deserialize(ModelDeserializer.java:20)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4905)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3713)
at dbcs.App.testBigDec(App.java:30)
at dbcs.App.main(App.java:20)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Character " is neither a decimal digit number, decimal point, nor "e" notation exponential mark. (through reference chain: io.swagger.models.ModelImpl["properties"]->java.util.LinkedHashMap["exampleNumber"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:402)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:361)
at com.fasterxml.jackson.databind.deser.std.ContainerDeserializerBase.wrapAndThrow(ContainerDeserializerBase.java:190)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:638)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:449)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:32)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4619)
... 8 more
Caused by: java.lang.NumberFormatException: Character " is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
at java.base/java.math.BigDecimal.<init>(BigDecimal.java:522)
at java.base/java.math.BigDecimal.<init>(BigDecimal.java:405)
at java.base/java.math.BigDecimal.<init>(BigDecimal.java:838)
at io.swagger.util.PropertyDeserializer.getBigDecimal(PropertyDeserializer.java:61)
at io.swagger.util.PropertyDeserializer.argsFromNode(PropertyDeserializer.java:193)
at io.swagger.util.PropertyDeserializer.propertyFromNode(PropertyDeserializer.java:347)
at io.swagger.util.PropertyDeserializer.deserialize(PropertyDeserializer.java:139)
at io.swagger.util.PropertyDeserializer.deserialize(PropertyDeserializer.java:41)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:623)
... 14 more
Do you know if we are hitting a limitation of swagger-core in this scenario? Should we be configuring some additional options on the Json.mapper() to handle this scenario?
Found that Json.mapper().configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true).readValue(schemaFile, Model.class); can be used which does not throw an exception.
Hello, we're hitting an error when trying to read a JSON schema which has a
number
property withminimum
/maximum
set to9.999999999999999999999999999999999E6144
into a Model.class. We are usingimplementation group: 'io.swagger', name: 'swagger-core', version: '1.6.14'
with Java 11, but hit similar issues at 8 or 17.The JSON schema example is:
The code we use is:
When this runs we get exception:
Do you know if we are hitting a limitation of swagger-core in this scenario? Should we be configuring some additional options on the
Json.mapper()
to handle this scenario?