You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading swagger-core from 2.2.22 to 2.2.25, the @DefaulValue value is now always cast to String, even for parameters of type Integer, Boolean or other simple types. I am using OpenAPI 3.1.
Expected behavior
@DefaultValue#value is represented in the right format in the spec, so the non-string types are not wrapped in quotes.
Similar to this issue the parameter schema was previously typed (like IntegerSchema, StringSchema etc) so the default value would be cast to the right type by calling the appropriate typed schema's cast() method. However, this upgrade and the fact that 3.1 version means to represent everything as a JsonSchema, the _default is not cast and always set to the String type.
The text was updated successfully, but these errors were encountered:
Problem
After upgrading swagger-core from 2.2.22 to 2.2.25, the
@DefaulValue
value is now always cast to String, even for parameters of type Integer, Boolean or other simple types. I am using OpenAPI 3.1.Expected behavior
@DefaultValue#value
is represented in the right format in the spec, so the non-string types are not wrapped in quotes.For example for the following endpoint
the contract representing the parameter would look like this (in 2.2.22)
but instead the parameter
default
value is represented as String (wrapped in quotes) (in 2.2.25)Reproducer
I am able to reproduce this by adding a test to ReaderTest class
with ExampleResource containing this endpoint
Investigation
Similar to this issue the parameter schema was previously typed (like
IntegerSchema
,StringSchema
etc) so the default value would be cast to the right type by calling the appropriate typed schema'scast()
method. However, this upgrade and the fact that 3.1 version means to represent everything as aJsonSchema
, the_default
is not cast and always set to the String type.The text was updated successfully, but these errors were encountered: