fix: use X | None syntax instead of Optional in py310 code structure …#1785
Closed
martinhewing wants to merge 2 commits intofastapi:mainfrom
Closed
fix: use X | None syntax instead of Optional in py310 code structure …#1785martinhewing wants to merge 2 commits intofastapi:mainfrom
martinhewing wants to merge 2 commits intofastapi:mainfrom
Conversation
Contributor
📝 Docs previewLast commit bf072b1 at: https://586c5d29.sqlmodel.pages.dev |
svlandeg
reviewed
Feb 25, 2026
Member
svlandeg
left a comment
There was a problem hiding this comment.
As you can see from the failing tests, this doesn't actually work.
…ructure example" This reverts commit bf072b1.
Author
|
Thanks for the review @svlandeg! Closing this one. |
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.
In
docs_src/tutorial/code_structure/tutorial002_py310/hero_model.py,the
teamfield was still usingOptional["Team"]while all otherfields had already been updated to use
X | Nonesyntax. This removesthe now-unused
Optionalimport and updates theteamfield to use"Team | None"— wrapped in quotes as required sinceTeamis aforward reference imported only under
TYPE_CHECKING.