Skip to content
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

remove required=False as a keyword arg #20

Open
chdsbd opened this issue Apr 15, 2021 · 0 comments
Open

remove required=False as a keyword arg #20

chdsbd opened this issue Apr 15, 2021 · 0 comments

Comments

@chdsbd
Copy link
Collaborator

chdsbd commented Apr 15, 2021

required=False is the default behavior. We should remove this option to prevent mistakes where callers mistakenly think required=True is the default behavior.

The following definitions are equivalent

class Post:
    author = fields.StringField()

class Post:
    author = fields.StringField(required=False)

This is different.

class Post:
    author = fields.StringField(required=True)

With this change, it would only be possible to write:

class Post:
    author = fields.StringField()

class Post:
    author = fields.StringField(required=True)

The following would error:

class Post:
    author = fields.StringField(required=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant