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

Fix validation for Body without $ref #185

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

Conversation

danopz
Copy link
Contributor

@danopz danopz commented Nov 22, 2017

This fixes the bug where required is not validated.
But fixing it this way leads test_local_parameter_values_override_schema to fail. I don't really get what this test is about, since the definition doesn't seem to be right?

Fixes #138

@mkraemer67
Copy link

mkraemer67 commented Dec 1, 2017

Any input on what needs to be done here? We'd love to integrate flex for validation of requests, but this is kind of a showstopper as it would need adapting all existing swagger schemas and keeping the workaround of defining everything via $ref in mind. Would be glad to assist.

@pipermerriam
Copy link
Owner

@mkraemer67 or @danopz tests are failing: https://travis-ci.org/pipermerriam/flex/jobs/305887945

Please get CI green and I can review this and get it merged.

@@ -125,7 +125,10 @@ def construct_parameter_validators(parameter, context):
if 'schema' in parameter:
schema_validators = construct_schema_validators(parameter['schema'], context=context)
for key, value in schema_validators.items():
validators.setdefault(key, value)
if key in validators:
validators[key] += value
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble following the logic behind this change which implies this section could use a comment explaining what is happening and why. Is that something you can add?

@danopz
Copy link
Contributor Author

danopz commented Dec 6, 2017

Added a comment trying to explain the merge of validators.
About the failing test this is the one I mentioned in the first comment. I don't really know if this test case is valid as is.

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.

Required parameter in body not validated without $ref
3 participants