-
-
Notifications
You must be signed in to change notification settings - Fork 937
✨ Use Pydantic for parameter validation #1831
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
Draft
svlandeg
wants to merge
82
commits into
fastapi:master
Choose a base branch
from
svlandeg:feat/pydantic
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,925
−2,247
Draft
Changes from 10 commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
9b6081d
add pydantic as requirement
svlandeg b54b308
use TypeAdapter for int and float validation
svlandeg c8640ae
Range adaptor and Pydantic error messages
svlandeg 10746de
UUID adapter
svlandeg 394e7f2
DateTime adapter
svlandeg 27f5880
Choice adapter
svlandeg 570d2be
introduce PydanticParamType
svlandeg c8f6dff
build_type_adapter
svlandeg 15a0e9a
consolidate enum validation
svlandeg 94cf21b
type adapter for bool parsing
svlandeg d0fe927
🎨 Auto format
pre-commit-ci-lite[bot] b749fc2
fix types
svlandeg 48ff1f4
param_type_from_annotation in new module param_types
svlandeg e0fd56d
move str and File to new module
svlandeg 5eb5ade
🎨 Auto format
pre-commit-ci-lite[bot] 4495762
clean up converter code
svlandeg 31432df
remove support for click_type and open bounds
svlandeg eaa68dd
datetime factory
svlandeg a0e429e
🎨 Auto format
pre-commit-ci-lite[bot] b79b401
move min/max info into TyperOption and TyperArgument and clamp using …
svlandeg 58bb823
Merge branch 'feat/pydantic' of https://github.com/svlandeg/typer int…
svlandeg 3953649
🎨 Auto format
pre-commit-ci-lite[bot] 943b335
repr cleanup
svlandeg 5b5085e
move _types.py stuff to param_types.py
svlandeg 7c201ec
move TyperPath to param_types.py as well
svlandeg 621280b
remove unused ignore statement
svlandeg b6165b7
centralize Pydantic functionality to adapaters.py
svlandeg 4332d34
resolve_param_type instead of convert_type
svlandeg 43f71ad
fix type
svlandeg d6bc20d
fix import
svlandeg fdf2973
few more test cases for default type inference
svlandeg 0336edf
move FuncParamType
svlandeg 98e200b
coercion through RuntimeParam schema, slim down PydanticParamType to …
svlandeg 12df977
move out File to param_types and extend RuntimeParam
svlandeg 4972630
some cleanup and refactor
svlandeg 9d97184
cleanup inline imports
svlandeg bab9056
TyperTuple into param_types
svlandeg 0809456
ChoiceRuntimeParam
svlandeg 80495f9
ChoiceRuntimeParam
svlandeg 199b28b
clean up ParamType methods and introduce TyperParameter
svlandeg 39a2c15
Merge branch 'master' into feat/pydantic
svlandeg 78a1c37
refactors and simplifications
svlandeg cfccba8
fix test
svlandeg 9a9bee7
some more cleanup in RuntimeParam/DeclaredParam/Parameter
svlandeg b7531f5
remove ParamType's repr functionality
svlandeg f98d311
consolidate metavar functionality and discard the short-lived Display…
svlandeg ab3863e
Merge branch 'master' into feat/pydantic
svlandeg 46e3fec
return metavar in <> and lowercased
svlandeg 1e6ff44
removing CommandSchema for now and make RuntimeParam required
svlandeg b157ea9
use TyperParameter more often and further unify metavar printing (sti…
svlandeg f3679c7
fix metavar for list
svlandeg 3b3459a
clean out param_types and move metavar functions to TyperParameter
svlandeg 0264bca
fix fixture and isolate temp dir
svlandeg de4e031
clean up default inference
svlandeg 0c8b6a8
PassThroughRuntimeParam instead of falling back to str
svlandeg 042d16c
small refactors for diff readability
svlandeg 8600249
Merge branch 'master' into feat/pydantic
svlandeg b448af6
formatting
svlandeg 0bf9b2f
remove intermediate layer DeclaredParam
svlandeg 9d778d4
🎨 Auto format
pre-commit-ci-lite[bot] 66f57a8
TypeDescriptor to solidify type coercion
svlandeg f462dab
Merge remote-tracking branch 'origin/feat/pydantic' into feat/pydantic
svlandeg 65dd995
🎨 Auto format
pre-commit-ci-lite[bot] 68c3a7f
remove unnecessary helper functions
svlandeg 9c08b7c
🎨 Auto format
pre-commit-ci-lite[bot] 0a0365a
fix types
svlandeg a1e10b6
Merge branch 'feat/pydantic' of https://github.com/svlandeg/typer int…
svlandeg 1f058cc
fix types (again)
svlandeg 07c724a
keep fixing types
svlandeg 291e4e9
remove _click/types and ParamType entirely
svlandeg c5f30ac
Merge branch 'master' into feat/pydantic
svlandeg 9b84173
better test for str resolved as path
svlandeg 6198cd6
even better test for str resolve
svlandeg 6230efc
avoid Path coercion for str-typed parameters
svlandeg 9c3ddd8
extend metavar test with defaults (will fail for now due to related i…
svlandeg 3948629
Merge branch 'master' into feat/pydantic
svlandeg 53a6cf0
fix metavar type display
svlandeg 166b22d
solidify metavar printing (part 1: brackets)
svlandeg f1cb56e
🎨 Auto format
pre-commit-ci-lite[bot] e7e8432
part 2 of metavar printing: use {} to denote arg/opt names otherwise …
svlandeg 27c7840
🎨 Auto format
pre-commit-ci-lite[bot] ddb56ab
Merge branch 'master' into feat/pydantic
svlandeg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
This test currently mimics
masterbehaviour 100%.