mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 17:09:59 +03:00
Add tags to openapi schemas
This commit is contained in:
parent
d985c7cbb9
commit
6b8353d3d2
|
@ -47,11 +47,13 @@ class SchemaGenerator(BaseSchemaGenerator):
|
||||||
operation = view.schema.get_operation(path, method)
|
operation = view.schema.get_operation(path, method)
|
||||||
# Normalise path for any provided mount url.
|
# Normalise path for any provided mount url.
|
||||||
if path.startswith('/'):
|
if path.startswith('/'):
|
||||||
|
tags = [path.split('/')[1]]
|
||||||
path = path[1:]
|
path = path[1:]
|
||||||
path = urljoin(self.url or '/', path)
|
path = urljoin(self.url or '/', path)
|
||||||
|
|
||||||
result.setdefault(path, {})
|
result.setdefault(path, {})
|
||||||
result[path][method.lower()] = operation
|
result[path][method.lower()] = operation
|
||||||
|
result[path][method.lower()].update(tags=tags)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user