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 x-nullable support for body validators #642
Conversation
|
||
def nullable_support(validator, properties, instance, schema): | ||
null_properties = {} | ||
for property_, subschema in six.iteritems(properties): |
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.
It looks like this is breaking the build by not throwing the right exception when the function is given an integer as input.
See the travis build for the failure.
This looks really close - there are some minor changes needed to fix the build, plus a rebase on master. Thanks for putting this together! |
tests/decorators/test_uri_parsing.py
Outdated
from werkzeug.datastructures import MultiDict | ||
|
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.
Unfortunately this breaks the isort step in the build. See the end of the python 3.6 travis run for details.
Can you please check for Pypy build? It can't download Pypy binaries. Otherwise all other builds are passed. |
hey @dmksnnk , sorry this fell off my radar. I kicked the build - seems like the problem was with travis-ci. |
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.
Looks great.
Did you consider pulling this into a "connexion/validators.py" file?
@dtkav thank you for checking this. What should be my next step? Move it to |
Only zalando employees can merge PRs into master, so we'll have to wait for either @jmcs or @hjacobs to have a look. I've merged it into Moving the code into another file is totally optional, I just wanted to raise the idea. I don't have a strong preference. |
actually, @dmksnnk if you can rebase on master, that would help. |
Hey @jmcs - This is looking good from my perspective. I recommend we merge this into master, what do you think? |
👍 |
Isn't this a bug ? Why x-nullable does not work on $ref ? For example:
|
@jankontrik you need to set
|
@dmksnnk Indeed I had that this way (x-nullable: true inside referenced object) but always ends with: |
I'm using python 3.6, connexion==1.5.2. |
if you check releases, this feature was added for version 1.5.3 |
@dmksnnk Yep. Sorry I know about which release. Of course I tried that on 1.5.3 but with the result above :(. Then I returned to 1.5.2 and forgot about the right version. |
Of course it is not good I absolutely agree. But this is some legacy stuff, no way to change. |
BTW the problem is always on additionalProperties when there is a x-nullable ref and None comes. |
Closes #439
Add
x-nullable
support in properties by adding property validator to defaultDraft4Validator
. It skips null-property with"x-nullable": true
and then adds it back.