python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
https://flask-restx.readthedocs.io/en/latest/
Other
2.16k stars 335 forks source link

How do I document the required header in and endpoint, when I'm passing a model to expect() instead of a regparse? #480

Closed db0 closed 2 years ago

db0 commented 2 years ago

Regparser is not good at documented nested models, so I have switched to passing a model into the @api.expect() decorator

@api.expect(models.input_model_request_generation, validate=True)

However that does not document my headers.

For headers, the documentation says the following

image

But I cannot use both parser and model to document. Passing parser to a subsequest @api.doc() decorator doesn't seem to work either.

How do I document the expected headers when using models in expect() ?

peter-doggart commented 2 years ago

Can you define the body as the model and a reqparser in api.doc like this old post over on restplus? Not at my computer to test it!: https://github.com/noirbizarre/flask-restplus/issues/511#issuecomment-471771892

db0 commented 2 years ago

This seems to work! Thanks!