Add support for Swagger tags
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
The Swagger spec provides support for assigning one or more 'tags' for each method. This is used by tools like Swagger UI to group methods, often by tags representing each resource. This results in very nice groupings as you can see in the PetStore example for pet, store, and user [here](http://petstore.swagger.io).
Implementation suggestions:
- Add an argument to the route decorator: tag=dict(name='pet', description='Everything about your pets')
- The spec lets you have multiple tags, but I think starting with a single tag might be okay and it looks simpler.
- When generating the swagger output, insert the tags= JSON with the value from the route view for name.
- Also append a tags_list entry every time you see a new tag name= value with both the name and description.
- Once all route JSON has been generated, output a tags=[...] key with the tags_list we've built.
Note that Swagger JSON for a route tag (under method) looks like:
```JSON
"tags": [
"pet"
]
```
And the top-level tags key:
```JSON
"tags": [
{
"name": "pet",
"description": "Everything about your pets"
}
```
Contributor guide
Assessment
This issue has not been assessed yet.