Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't infer response_model for invalid types #260

Closed

Conversation

nzig
Copy link

@nzig nzig commented Sep 14, 2022

It is possible for inferring_router to raise an exception if a function uses a return type that is not a valid response_model. An example is an endpoint that returns Response instead of letting FastAPI construct one.

This PR fixes that by only inferring the response_model if the return annotation is a valid response_model.

Fixes #229
Fixes #172

@nzig
Copy link
Author

nzig commented Jan 16, 2023

This is now builtin to FastAPI (https://fastapi.tiangolo.com/release-notes/#0890), so I'm closing this PR.

@nzig nzig closed this Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant