-
-
Notifications
You must be signed in to change notification settings - Fork 532
Syntax error when enum in a Schema Object is a list of objects #876
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
Comments
I think I'm experiencing the same issue but with different error:
It seems like this library has a bug when reading |
Experiencing the same issue while parsing Docker v1.41 OpenApi specs:
So far it seems like @rkulinski is right, this is most likely due to enums, but more specifically: empty enums. There are multiple enums before the one which crashes on Docker OpenApi specs, and the only ones crashing on my side are the empty ones, f.e: ExposedPorts:
description: |
An object mapping ports to an empty object in the form:
`{"<port>/<tcp|udp|sctp>": {}}`
type: "object"
additionalProperties:
type: "object"
enum:
- {}
default: {} Could you please confirm on your side that this may be the issue for you as well @rkulinski ? 😄 |
experencing the same issue when parsing https://api.mailchimp.com/schema/3.0/Swagger.json?expand {
"in": "query",
"name": "activity_filters",
"x-title": "Activity Filters",
"type": "array",
"required": false,
"items": {
"type": "string"
},
"collectionFormat": "csv",
// error happened here
"enum": [
[
"bounce"
],
// other options removed
],
"description": "A comma-separated list of activity filters that correspond to a set of activity types, e.g \"?activity_filters=open,bounce,click\"."
} The generated enum value miss quotes. |
I'm facing the exact same issue as @Leafgard |
This definitely seems like a bug. If someone is able to create a PR to fix this (with tests) I’d be happy to merge & release |
This has been added in the upcoming v6 version (#968). Closing in anticipation of that, but once that’s launched, if there are any issues please file additional bugs. |
If a Schema Object
enum
contains a list of objects (instead of—more commonly—a list strings) an error is thrown:SyntaxError: '=>' expected.
This error message looks similar to the one in bug #561.Note that an
enum
in a schema object may contain a list of anything. As per https://swagger.io/specification/#schema-objectenum
“[is] taken directly from the JSON Schema definition and follow[s] the same specifications”. The JSON Schema definition, https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.20, says that “Elements in the array MAY be of any type, including null.”The text was updated successfully, but these errors were encountered: