diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 8dea70902..5766a6a61 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -310,7 +310,7 @@ If you need more configuration over the `operationId` field, you can override th ```python class CustomSchema(AutoSchema): - def get_operation_id_base(self, action): + def get_operation_id_base(self, path, method, action): pass def get_operation_id(self, path, method): diff --git a/rest_framework/schemas/openapi.py b/rest_framework/schemas/openapi.py index b00fceb67..ac6482b26 100644 --- a/rest_framework/schemas/openapi.py +++ b/rest_framework/schemas/openapi.py @@ -115,7 +115,7 @@ class AutoSchema(ViewInspector): return operation - def get_operation_id_base(self, action): + def get_operation_id_base(self, path, method, action): """ Compute the base part for operation ID from the model, serializer or view name. """ @@ -164,7 +164,7 @@ class AutoSchema(ViewInspector): else: action = self.method_mapping[method.lower()] - name = self.get_operation_id_base(action) + name = self.get_operation_id_base(path, method, action) return action + name diff --git a/tests/schemas/test_openapi.py b/tests/schemas/test_openapi.py index a764f6bfd..ab206198e 100644 --- a/tests/schemas/test_openapi.py +++ b/tests/schemas/test_openapi.py @@ -627,7 +627,7 @@ class TestOperationIntrospection(TestCase): def test_operation_id_override_base(self): class CustomSchema(AutoSchema): - def get_operation_id_base(self, action): + def get_operation_id_base(self, path, method, action): return 'Item' path = '/'