Skip to content

Commit

Permalink
Added some docs for external doc_dir and parsed MethodView.
Browse files Browse the repository at this point in the history
  • Loading branch information
javabrett committed Aug 27, 2018
1 parent aaef05c commit 11de49a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,12 @@ app.run(debug=True)

```

## Auto-parsing external YAML docs and `MethodView`s

Flasgger can be configured to auto-parse external YAM API docs. [Set a `doc_dir`](https://github.com/rochacbruno/flasgger/blob/aaef05c17cc559d01b7436211093463642eb6ae2/examples/parsed_view_func.py#L16) in your `app.config['SWAGGER']` and Swagger will load API docs by looking in `doc_dir` for YAML files stored by endpoint-name and method-name. For example, `'doc_dir': './examples/docs/'` and a file `./examples/docs/items/get.yml` will provide a Swagger doc for `ItemsView` method `get`.

Additionally, when using **Flask RESTful** per above, by passing `parse=True` when constructing `Swagger`, Flasgger will use `flask_restful.reqparse.RequestParser`, locate all `MethodView`s and parsed and validated data will be stored in `flask.request.parsed_data`.

## Handling multiple http methods and routes for a single function

You can separate specifications by endpoint or methods
Expand Down

0 comments on commit 11de49a

Please sign in to comment.