ref #284 and #360
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 an int field, pydantic will convert it to an int
- if you pass
3.14 (which again is not an int) to an int field, 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:
This is a big, backwards incompatible change for no material benefit but I think it's worth it for clarity.
ref #284 and #360
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.
"3"(which is not an int) to anintfield, pydantic will convert it to an int3.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:
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 docsThis is a big, backwards incompatible change for no material benefit but I think it's worth it for clarity.