Skip to content
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

Add type check when validating definition #136

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ngaya-ll
Copy link

@ngaya-ll ngaya-ll commented Jun 8, 2020

This prevents an AttributeError when validating definitions like this:

type: object
properties: ...
additionalProperties: false

@coveralls
Copy link

coveralls commented Jun 8, 2020

Coverage Status

Coverage increased (+0.006%) to 98.563% when pulling 91af7a8 on ngaya-ll:additional-properties-bool into 7234ed9 on Yelp:master.

@ngaya-ll
Copy link
Author

ngaya-ll commented Jun 9, 2020

#138 added support for boolean additionalProperties which invalidates one of the test cases in this PR. I'm not sure whether this is correct as the Swagger 2.0 spec is a bit vague about that, see OAI/OpenAPI-Specification#668.

@macisamuele
Copy link
Collaborator

I'll try to have a look to the PR and the Specifications later this evening.

For what I remember the schemas defined in #/definitions/<key> must be dictionaries, and the PR seems ensuring this but I'm not 100% sure. So I need to validate this and check the code change.

@ngaya-ll thanks for the PR and for holding tight with us until a proper review is possible.

@macisamuele macisamuele self-requested a review June 10, 2020 09:08
@sjaensch
Copy link
Contributor

I remember us looking into additionalProperties and the fact that it can be a boolean value in the past, it just slipped through during the code review for #134. OAI/OpenAPI-Specification#668 mentions that (more explicit) support for a boolean value was added in OpenAPI 3.0. See OAI/OpenAPI-Specification#894.

Given all of that, we should allow boolean values for additionalProperties in OpenAPI 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants