-
-
Notifications
You must be signed in to change notification settings - Fork 228
feat(parser): Detect OpenAPI documents of incorrect versions (closes #281) #302
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
Conversation
47fc9f7
to
0a0cb88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question but other that that LGTM
if "swagger" in d: | ||
detail = ( | ||
"You may be trying to use a Swagger document; this is not supported by this project.\n\n" + detail | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just check for this or the openapi
field before attempting to parse the dict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I don't think it's illegal to have extra fields (e.g.
swagger
) so I don't want to disallow that if the spec is otherwise valid - Validating the format of
openapi
seems like a task for Pydantic since the semver requirement is part of the OpenAPI spec.
openapi
field and removes the default (it's a required field)openapi
field is 3swagger
attribute at the top level and provide a hint to the user that they might be using an older, unsupported version.