connexion
connexion copied to clipboard
[Question] Is there a prescribed way to generate response model from openapi spec?
Description
Thanks for this great framework. I would like to know the connexion prescribed way to generate response models. It is really hard to work with arbitrary python dictionary when preparing a huge response with multiple fields. I would love to use pydantic, but there is no proper tool to generate pydantic models from swagger spec.
https://github.com/koxudaxi/datamodel-code-generator is not perfect but quite usable now for this task. However, using pydantic objects directly for responses is not easily possible right now.
Related to this question, is it possible to hook the request model validation to supply the Pydantic model as an input?
The ideal workflow for me would be to use the datamodel-code-generator to produce models, which are then typed as the actual models so my IDE can codehint/guide their use in the handler functions appropriately.