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': fields.String(default = 'string: name', required = True),
'state': fields.String(default = 'string: state'),
})
@api.route('/my-resource/<id>')
class MyResource(Resource):
@api.expect(resource_fields, validate=True)
def post(self):
...
must have 'name' field and may have 'state' field, but also to check that there are no other fields (and to raise an error if this happens). Is there another decorator for this? Can I check the correctness of the input data by a custom function?