Skip to content

Clarify that only required=True conflicts with default in field docs - #10030

Merged
browniebroke merged 1 commit into
encode:mainfrom
epuronta:clarify-default-required-docs
Sep 1, 2026
Merged

Clarify that only required=True conflicts with default in field docs#10030
browniebroke merged 1 commit into
encode:mainfrom
epuronta:clarify-default-required-docs

Conversation

@epuronta

@epuronta epuronta commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The fields docs say that "including both the default and required keyword arguments is invalid and will raise an error". The assertion in Field.__init__ is assert not (required and default is not empty), so only required=True combined with a default raises. An explicit required=False passes silently. Reword the note to match the implemented behavior.

@browniebroke browniebroke changed the title Clarify that only required=True conflicts with default in field docs Clarify that only required=True conflicts with default in field docs Sep 1, 2026
@browniebroke
browniebroke merged commit ae9fd0c into encode:main Sep 1, 2026
7 checks passed
@browniebroke

Copy link
Copy Markdown
Collaborator

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants