mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
rebased on master
This commit is contained in:
parent
6e072dbb45
commit
03d3406734
|
@ -310,7 +310,7 @@ If you need more configuration over the `operationId` field, you can override th
|
||||||
|
|
||||||
```python
|
```python
|
||||||
class CustomSchema(AutoSchema):
|
class CustomSchema(AutoSchema):
|
||||||
def get_operation_id_base(self, action):
|
def get_operation_id_base(self, path, method, action):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_operation_id(self, path, method):
|
def get_operation_id(self, path, method):
|
||||||
|
|
|
@ -115,7 +115,7 @@ class AutoSchema(ViewInspector):
|
||||||
|
|
||||||
return operation
|
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.
|
Compute the base part for operation ID from the model, serializer or view name.
|
||||||
"""
|
"""
|
||||||
|
@ -164,7 +164,7 @@ class AutoSchema(ViewInspector):
|
||||||
else:
|
else:
|
||||||
action = self.method_mapping[method.lower()]
|
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
|
return action + name
|
||||||
|
|
||||||
|
|
|
@ -627,7 +627,7 @@ class TestOperationIntrospection(TestCase):
|
||||||
|
|
||||||
def test_operation_id_override_base(self):
|
def test_operation_id_override_base(self):
|
||||||
class CustomSchema(AutoSchema):
|
class CustomSchema(AutoSchema):
|
||||||
def get_operation_id_base(self, action):
|
def get_operation_id_base(self, path, method, action):
|
||||||
return 'Item'
|
return 'Item'
|
||||||
|
|
||||||
path = '/'
|
path = '/'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user