-
Notifications
You must be signed in to change notification settings - Fork 76
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
Support for oneOf composition #132
Conversation
Not sure how |
Likely a new version of flake8 with updated or new rules. Thanks for fixing. |
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.
just the two minor bits of feedback. If you can address those I'll get this merged and released.
it = iter(iterable) | ||
# check that one is True, then check that none is True in rest of the | ||
# iterator | ||
return any(it) and not any(it) |
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.
This is really clever. Enough so that I'd like to request that you write a set of simple test cases that demonstrate it works because it's not entirely intuitive at a glance how it works. I do however like this pattern alot.
@@ -299,7 +300,7 @@ def generate_enum_validator(enum, **kwargs): | |||
|
|||
|
|||
@skip_if_empty | |||
def validate_allof_anyof(value, sub_schemas, context, method, **kwargs): | |||
def validate_composition(value, sub_schemas, context, method, default_error_message=None, **kwargs): |
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 think error_message_override
might be a more appropriate name than default_error_message
. Alternatively I'd support removing this in place of just writing 3 small functions which each raised the appropriate error message for all/any/exactly_one_of
so that this function doesn't have to expand it's signature. Your call.
@maroux If you you can hit the two small requests for cleanup I'll get this merged. Also it appears this now needs to be rebased. |
Any change of merging this? |
I can make the cleanup commits if @maroux don't mind |
@pipermerriam @maroux What do you think? |
Yeah go for it. Sorry I haven't had a chance to work on it in so long!
…On Thu, Nov 23, 2017 at 2:17 AM Alex R ***@***.***> wrote:
@pipermerriam <https://github.com/pipermerriam> @maroux
<https://github.com/maroux> What do you think?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#132 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADHZdhpoBmdNpxX65WQ1fBGnQ9sKXW6Rks5s5UZLgaJpZM4LJPSw>
.
|
@lyssdod please do. Ping me when this is ready for review. I'm closing this issue so you can open your own PR (which it appears you've already done) |
Fixes #131