flask-restx icon indicating copy to clipboard operation
flask-restx copied to clipboard

Compatibility with Pydantic Models

Open napocornejo opened this issue 10 months ago • 2 comments

Pydantic has become increasingly popular in the python world, and API development is of particular interest. Many API's work based on json requests which are a natural serialization for pydantic. However there is currently no way to create the flask-restx models from pydantic models.

Ideally, decorators like:

api.marshal_with(model) namespace.doc(model=model)

can accept pydantic models.

At the moment I create utilitarian functions that device the flask-restx models from the pydantic models. Given the popularity of Pydantic this would be ideal to come out of the box in flask-restx.

napocornejo avatar Feb 19 '25 10:02 napocornejo