-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
Enforcedefaults aiohttp #1163
Enforcedefaults aiohttp #1163
Conversation
@@ -24,7 +23,9 @@ def __init__(self, | |||
|
|||
@property | |||
def json(self): | |||
return self.json_getter() | |||
if not hasattr(self, '_json'): |
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 this change is unrelated to your example, why did you add 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.
It is related. Actually, it fixes the issue #1162. As opposed to FlaskApp, this code says that the body is recomputed each time we access ConnexionRequest.json
. So if a validator changes the json, it is not reflected in the body
argument because here it is recomputed again. This change avoids the recomputation and uses the same reference (which has been modified by the validator) again.
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.
Really, please try the example without this change and see that it behaves differently (the foo
attribute is not added with the default value).
Pull Request Test Coverage Report for Build 1889774255
💛 - Coveralls |
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.
Thx @p4l1ly!
Fixes #1162 .
Changes proposed in this pull request:
ConnexionRequest.json
property.