-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
changeSuggested alteration to Pydantic, not a new feature nor a bugSuggested alteration to Pydantic, not a new feature nor a bugdocumentationfeedback wanted
Description
Pydantic is no a validation library, it's a parsing library.
It makes no guarantee whatsoever about checking the form of data you give to it; instead it makes a guarantee about the form of data you get out of it.
This sounds like an esoteric difference, but it has real practical consequences, eg.
- if you pass
"3"(which is not an int) to anintfield, pydantic will convert it to an int - if you pass
3.14(which again is not an int) to anintfield, pydantic will convert it to an int (thereby "loosing information")
I think this is correct and I'm not interested in changing it, but we should be clear about what pydantic is/does - while I was annoyed by the manor of the question in #284 (sorry, wrong issue, I meant #360) I do understand the motivation for the question.
To fix this we should:
- add the above statement prominently to the docs
-
renamevalidate_modeltoparse_model(this will require the old version to continue to work with a deprecation warning for 2 versions) -
rename__get_validators__to__get_parser_functions__or similar (again will require the old function to continue to work with a deprecation warning) -
remove use of "validate"/"validation" from the docs
This is a big, backwards incompatible change for no material benefit but I think it's worth it for clarity.
tiangolo, retnikt, hademircii, mblakesley, Skyross and 16 morebluenote10, dostuffthatmatters and Samathingamajig
Metadata
Metadata
Assignees
Labels
changeSuggested alteration to Pydantic, not a new feature nor a bugSuggested alteration to Pydantic, not a new feature nor a bugdocumentationfeedback wanted