In my flask-restplus API I\'d like not only to check that input data, like in the following example
resource_fields = api.model(\'Resource\', {
\'name\': fie
Here is another answer to complete the one from @shiv. The following code snippet allows you to have your payload documented in the Swagger doc generated by Flask Restplus. Taken from the documentation about the expect decorator:
my_resource_parser = api.parser()
my_resource_parser.add_argument('name', type=str, default='string: name', required=True)
my_resource_parser.add_argument('state', type=str, default='string: state')
@api.route('/my-resource/', endpoint='with-parser')
class MyResource(Resource):
@api.expect(my_resource_parser)
def post(self):
args = my_resource_parser.parse_args(strict=True)
...