From 6b8353d3d237c19c23d3e24e3b617c86ec26a639 Mon Sep 17 00:00:00 2001 From: Melon Date: Wed, 25 Dec 2019 11:03:11 +0700 Subject: [PATCH] Add tags to openapi schemas --- rest_framework/schemas/openapi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rest_framework/schemas/openapi.py b/rest_framework/schemas/openapi.py index 134df50434..2f3bbe3803 100644 --- a/rest_framework/schemas/openapi.py +++ b/rest_framework/schemas/openapi.py @@ -47,11 +47,13 @@ def get_paths(self, request=None): operation = view.schema.get_operation(path, method) # Normalise path for any provided mount url. if path.startswith('/'): + tags = [path.split('/')[1]] path = path[1:] path = urljoin(self.url or '/', path) result.setdefault(path, {}) result[path][method.lower()] = operation + result[path][method.lower()].update(tags=tags) return result