2

Is it possible with Flask Restplus to create a model for a multipart/form-data request so that I can use it to validate the input with @api.expect?

I have this complex data structure for which I've created a api.namespace().model that has to be received together with a file. However when I tried to document the endpoint I noticed that this doesn't seem to be supported by Flask Restplus.

I've tried to find something along the lines of

parser = ns.parser()
parser.add_argument("jsonModel", type=Model, location="form")
parser.add_argument("file", type=FileStorage, location="files")

and

formModel = ns.model("myForm", {"jsonModel": fields.Nested(myModel), "file": fields.File})

But neither methods seem to support this kind of behavior.

Jurgy
  • 2,128
  • 1
  • 20
  • 33

0 Answers0