jmcarp / flask-apispec

MIT License
655 stars 157 forks source link

No request/response information in generated Swagger docs #18

Open henadzit opened 8 years ago

henadzit commented 8 years ago

Hi,

I run the example code from README and checked the generated swagger docs: https://gist.github.com/henadzit/e17328dc9d46d00cca8d0519355203dc

It doesn't contain information about request and response formats which could be extracted from use_kwargs and marshal_with decorators. Is it expected?

adelavega commented 7 years ago

I second this problem. Using the MethodView definition below, all is documented (including the output schema), except for the webargs kwargs.

Oddly enough, this seem quite finicky as sometimes if you add a tag in the docstring, the arguments will magically be auto-documented. For example, if the docstring is removed entirely, the arguments will appear.

My guess is that there is an issue parsing the docstring, but i've got no clue where to look.

@sloria, @jmcarp ?

    class RunListResource(MethodResource):
         """ Run list.
         ---
         get:
             summary: Returns list of runs.
             responses:
                 200:
                     description: successful operation
                     schema: RunSchema          
         """
         @marshal_with(RunSchema(many=True))
         @use_kwargs({'session': wa.fields.DelimitedList(fields.Str())})
         def get(self, **kwargs):
             """ Code here"""
adelavega commented 7 years ago

Update: if I move the docstring YAML to the get function, the arguments are detected, but now tags are ignored.