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

Should type be required for schemas and schema properties? #119

Open
amygdalama opened this issue Jun 28, 2016 · 0 comments
Open

Should type be required for schemas and schema properties? #119

amygdalama opened this issue Jun 28, 2016 · 0 comments

Comments

@amygdalama
Copy link

We noticed that some developers forgot to declare types in our schemas, and as a result validating responses against those schemas doesn't behave as strictly as we would like.

Here's an example:

>>> from flex.core import validate
>>> schema
{'additionalProperties': False, 'properties': {'name': {'type': 'string'}}}
>>> data = 0    
>>> validate(schema, data)

I forgot to add type: object here for the schema. Now, any data of any type can pass validation against this schema.

I'm not sure if this is a bug or not. I'd prefer flex to raise an error here, since it can't know how to validate data without a type. But maybe OAS allows undeclared types? I tried looking through the specification and didn't come up with anything. What do you think?

Here's a picture of cute anteaters.

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

No branches or pull requests

1 participant