-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum string value "YES" becomes "true" #1205
Comments
Yup, that's possible behavior when using YAML 1.1. As mentioned in the linked ticket, for now, the workaround is to explicitly say it's a string to avoid the parsing to consider it a boolean. |
I am not sure what YAML version OpenApi uses, but I have within the new-issues.yaml set it to use OpenApi 3.0. Looking at the code OpenAPIV3Parser.java converts the YAML using io.swagger.v3.parser.OpenAPIV3Parser.YAML_MAPPER. This bug might be releated: OpenAPITools/openapi-generator#3196 |
That's actually not true, @piebur. JSON Schema doesn't work that way. The |
I could fix it using the On/Off enum (the ones with issue) value to be under a double quote ("). Example
|
Related: swagger-api/swagger-core#3372 |
still happening in swagger-parser 2.1.16. Can this be fixed please? |
That's not a practical workaround when I'm using external arbitrary openapi definitions. Is there a workaround that tells the swagger openapi parser to not make this substitution? I see this in the OpenAPI 3.0.3 specification:
I've had a bit of a hunt in I see some mention that Jackson 3.x will provide YAML 1.2 parsing. Are we waiting for that before fixing this issue? BTW I have no idea when Jackson 3.x will turn up. See also #1741. Just to give an idea of how much of this enum problem is out there in major org apis, the below list of 108 apis that use enums with one or more of non-quoted
|
I came up with a workaround. I create a subclass of OpenAPIV3Parser parser = new EnhancedOpenAPIV3Parser();
SwaggerParseResult result = parser.readLocation(definition, null, options); |
I have encountered an exception which looks suspicious while utilizing the String enum property with the value YES. The result is that YES becomes true somehow?
My guess is that is has to do with the conversion from YAML to JSON.
Reproduce:
A work around could be to replace YES with some other string else or just add " to make it a string
Reference: vert-x3/vertx-web#1394
reproduce.zip
The text was updated successfully, but these errors were encountered: