Replies: 3 comments
-
There is a (See the linked pydantic issue discussion for a more lengthy response about the tradeoffs involved with changing this behavior.) |
Beta Was this translation helpful? Give feedback.
-
I'm talking about expected behavior from a consumer/user's standpoint. That is why I brought this up to see if fastapi should take an opinionated stance on how strict it's endpoints should be. Maybe it should use a I'm not going to pursue using fastapi any further, so please do whatever makes sense. |
Beta Was this translation helpful? Give feedback.
-
Yeah, that's how Python itself works. Anyway, hope you find a framework or language that suits your needs. As I understand you already decided about your original question, I'll close this issue now. |
Beta Was this translation helpful? Give feedback.
-
I was mucking about with fastapi and tried sending the json value false to a str field.
Imagine my surprise when "False" was saved in my database instead of getting a 4xx response.
Now, I might have done something wrong, though I've just copied/pasted the docs - which just use the default settings.
The data passed into pydantic really is a
False
See pydantic/pydantic#1130 as well.
I'm wondering if the default settings are pedantic is enough or if fastapi should ship with a
StrictModel
instead?Beta Was this translation helpful? Give feedback.
All reactions