Replies: 10 comments
-
Can you run the server with |
Beta Was this translation helpful? Give feedback.
-
http put localhost:8000/items/image url="htp://www.google.com" name="df" File "/Users/guoqingsun/PycharmProjects/fastapi/venv/lib/python3.7/site-packages/starlette/middleware/errors.py", line 156, in call |
Beta Was this translation helpful? Give feedback.
-
btw, I got it fixed by changing line 172 in pydanic/errors.py, wrapped allowed_schemes with a list: but this may not the right place to fix it as pydanic/errors.py is not responsible to grantee the error is in JSON format |
Beta Was this translation helpful? Give feedback.
-
Ah okay, this is actually fixed on master in FastAPI; the change affects this line:
The next release of FastAPI should fix this for you (and you'll be able to drop the modification to pydantic). |
Beta Was this translation helpful? Give feedback.
-
Sounds great, thanks |
Beta Was this translation helpful? Give feedback.
-
I'm not sure if this is related, but when I return a list of models, some of which have validation errors, I am getting 500 instead of a 422.
If this doesn't sound related, I'll open a separate issue and put together a reproducible example. I can also try downgrading FastAPI & Pydantic to see if the recent upgrade to 0,.440 and 1.2 (respectively) made a difference. Environment
|
Beta Was this translation helpful? Give feedback.
-
@tazimmerman I think this is a separate issue -- it would be great if you could produce a small reproducible example in a new issue. (But make sure 0.44.1 doesn't just fix it.) @thomassun hopefully 0.44.1 fixes your problem; let us know if you still have an issue after upgrading. |
Beta Was this translation helpful? Give feedback.
-
I upgraded to 0.44.1 but that didn't fix it. Thanks to the incredibly easy to use API :) I was able to put together a simple example to reproduce the error. I'll open it as a separate issue. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the discussion here! @thomassun was your problem solved? |
Beta Was this translation helpful? Give feedback.
-
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
got a 500 status with "TypeError: Object of type set is not JSON serializable" if I feed a invalid httpurl as Body
To Reproduce
Steps to reproduce the behavior with a minimum self-contained file.
/items/image
with body value:{"url":"htp://www.google.com","name":"something"}
. here the schema of URL is invalidExpected behavior
the type validation should know the wrong URL and give a clear indication
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Beta Was this translation helpful? Give feedback.
All reactions