Revise the section on required / optional / nullable fields.#6468
Merged
tpdorsey merged 9 commits intopydantic:mainfrom Jul 6, 2023
Merged
Revise the section on required / optional / nullable fields.#6468tpdorsey merged 9 commits intopydantic:mainfrom
tpdorsey merged 9 commits intopydantic:mainfrom
Conversation
Contributor
Author
|
please review |
ybressler
commented
Jul 5, 2023
dmontagu
reviewed
Jul 5, 2023
Contributor
dmontagu
left a comment
There was a problem hiding this comment.
One other thing that I think would be good — in V1, all of this also applied for fields annotated as Any. It might be worth adding a note that this has changed as well — fields annotated as Any no longer have a default of None either.
Co-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>
Co-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>
Co-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>
tpdorsey
approved these changes
Jul 6, 2023
lig
suggested changes
Jul 6, 2023
Co-authored-by: Serge Matveenko <lig@countzero.co>
Co-authored-by: Serge Matveenko <lig@countzero.co>
|
the second of these entries seems just to be a less-fully-explained copy of the first? | Not required, cannot be `None`, is `'abc'` by default | `f3: str = 'abc'` |
| Not required, cannot be `None` | `f4: str = 'Foobar'` | |
Contributor
|
@dimbleby Nice catch. Thanks! Would you like making a PR?;) |
|
negative, sorry! |
Contributor
|
I will follow up on this. Thanks for pointing it out @dimbleby Cheers |
4 tasks
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.
Change Summary
Small enhancements to migration documentation – explicitly call out the breaking change of optional fields. (Related to #6463)
Note:
I created 2 alternative tables for demonstrating how fields are defined, cause I'm not sure which one we should go with. (Or, if we should keep it as a bullet pointed list. Or, if we should scrap it and just keep the code example below it.)
Checklist
Unit tests for the changes existTests pass on CI and coverage remains at 100%changes/<pull request or issue id>-<github username>.mdfile added describing change(see changes/README.md for details)
Selected Reviewer: @lig