-
Notifications
You must be signed in to change notification settings - Fork 10
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
Isra/optional default #269
base: main
Are you sure you want to change the base?
Conversation
7f10a7a
to
61e8105
Compare
field.load_default = None | ||
field.allow_none = True | ||
metadata[_DESERT_SENTINEL]["allow_none"] = True | ||
if default is marshmallow.missing: |
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 would argue that this behavior is quite counter intuitive, but if we want to keep backward compatibility this is needed.
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.
If you want an optional value, then do the same as all python code and do x: Optional[int] = None
61e8105
to
3e9b593
Compare
Codecov Report
@@ Coverage Diff @@
## main #269 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 472 476 +4
Branches 90 93 +3
=========================================
+ Hits 472 476 +4
|
FYI I don't personally have time to work on this repo these days. Other collaborators should be able to review if they're interested, so you might ping someone to see if there's interest. |
I was investigating why
Optional
default was broken (ie.x: Optional[int] = 1
would default toNone
) and ended up refactoring a good bunch of the code, finding out that defaults seemed to be overall quite broken.