response_model_exclude in docs #7917
Replies: 3 comments
-
As far as I'm aware, there is no automatic way to do this. You should be able to specify the schema manually through I also think it should be possible to automate after generating the app's openapi schema (by calling Given the potential security-oriented nature of this request, I think it would be a good thing to support, so if someone wants to implement this I would be happy to review the pull request. And if it ends up being too complex or otherwise not a great fit for the main |
Beta Was this translation helpful? Give feedback.
-
I think the best way to approach it would be to create a model that doesn't have the fields that you want to exclude. And other models could inherit from it and add the extra fields in some contexts where needed.
|
Beta Was this translation helpful? Give feedback.
-
Makes sense! ) |
Beta Was this translation helpful? Give feedback.
-
when using response_model_exclude=[fields] is it possible to exclude those fields from displaying in the docs as well?
Beta Was this translation helpful? Give feedback.
All reactions