Optional parameters can be omitted from payload.#7
Merged
dahlia merged 3 commits intonirum-lang:masterfrom Jan 8, 2018
Merged
Conversation
Resolve #205
496814d to
ad25d27
Compare
dahlia
requested changes
Jan 8, 2018
nirum_wsgi.py
Outdated
| def _get_argument_value(payload, key, type_): | ||
| # if is_union_type(type_) is true, type_ is optional type. | ||
| # https://github.com/spoqa/nirum-python/blob/maintenance-0.6/nirum/deserialize.py#L209 | ||
| if key in payload or is_union_type(type_): |
Member
There was a problem hiding this comment.
We'd better have nirum._compat.is_optional_type() or such thing which tests whether it's a union type and one of its possible types is type(None).
dahlia
reviewed
Jan 8, 2018
nirum_wsgi.py
Outdated
|
|
||
| def is_optional_type(type_): | ||
| return is_union_type(type_) and \ | ||
| any(isinstance(None, ut) for ut in get_union_types(type_)) |
Member
There was a problem hiding this comment.
Why not type(None) in get_union_types(type_)
2504365 to
de5643c
Compare
de5643c to
79ef693
Compare
dahlia
approved these changes
Jan 8, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve nirum-lang/nirum#205