How to add apispec for post method in flask MethodView?

433 views Asked by At

I have the following packages in my project: 1. flask (webframework) 2. webargs and marshmallow for request and response definition 3. apispec and apispec-webframework.flask for generation of openapi 3.0 doc.

Our project has chosen to use MethodView from flask to define APIs. One of our API looks like the following.

POST /resource/<resource-id>
{
"attribute-1": <attribute-value1>,
"attribute-2": <attribute-value1>,
}

The apispec documentation lists how to specify responses but there is no clear way of defining the input from path (resource-id) and request body (attributes). https://apispec.readthedocs.io/en/stable/using_plugins.html?highlight=MethodView

I would appreciate if someone could clarify how to use webargs and marshmallow to define the input for a MethodView:post() method for the above API.

0

There are 0 answers