stricter str validation#52
Conversation
Codecov Report
@@ Coverage Diff @@
## master #52 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 10 10
Lines 694 704 +10
Branches 155 157 +2
=====================================
+ Hits 694 704 +10 |
ad2fc6a to
d92d315
Compare
20157bf to
3b1d096
Compare
|
Thank you for the fix. I appreciate it. However, I still think that "strict by default" would be better. I would expect pydantic to check the types, instead of cleaning the data: If I pass my data to a model, and it doesn't raise a Validation error, I expect my data to be of the right types. I expected Pydantic to more like mypy: a typechecker. Mypy would not allow an But maybe I shouldn't complain: |
|
This is strict by default. What were you expecting?
…On 21 Jun 2017 3:53 pm, "Zweedeend" ***@***.***> wrote:
Thank you for the fix. I appreciate it.
However, I still think that "strict by default" would be better. I would
expect pydantic to check the types, instead of cleaning the data: If I pass
my data to a model, and it doesn't raise a Validation error, I expect my
data to be of the right types. I expected Pydantic to more like mypy: a
typechecker. Mypy would not allow an int were a str is required.
But maybe I shouldn't complain: dict(Model(**my_data)) will have the
right types.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#52 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD2jGfRfnUw-g92IVevEjPYi2Wld5naPks5sGS6HgaJpZM4OA5XB>
.
|
|
oh, I see what you mean now. I'll add But I don't want to change the default as I think if as user submits |
3b1d096 to
8c25581
Compare
8c25581 to
1696858
Compare
|
Nice work 👍 |
fix #45
In the end, I thought about this and decided whitelisting things which can be coerced to strings made more sense.
It shouldn't affect performance much as most string-like things will be strings and returned before this logic kicks in.