2

Hei there!

I have a flask restx api and I have an endpoint that essentially needs to do the following

filters = api.model('filters', {
  x = fields.Raw('x')
}

parser = reqparse.RequestParser()
parser.add_argument('b', type=int, location='args')

class Process(Resource):
  @api.expect(filters)
  @api.expect(parser)
  def get()
  .      
  .

why?

I have a large set of endpoints that all accept the same filter design, but some endpoints also need query parameters

The code works just fine, I can access the json payload and the query parameters inside the method.

The problem I need everything documented by swagger but I need to "mix" the api.model object with the parser object into the @api.expect()

isebarn
  • 3,812
  • 5
  • 22
  • 38

1 Answers1

0

@api.expect(filters,parser) should work