Skip to content

Commit

Permalink
Fixes encode#6875 - OpenAPI Schema inconsistent operationId casing
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfarrell committed Aug 19, 2019
1 parent 8441c5e commit 3bc39cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rest_framework/schemas/openapi.py
Expand Up @@ -135,7 +135,10 @@ def _get_operation_id(self, path, method):
name = name[:-7]
elif name.endswith('View'):
name = name[:-4]
if action != 'list' and name.endswith(action): # ListView, UpdateAPIView, ThingDelete ...

# Due to camel-casing of classes and `action` being lowercase, apply title in order to find if action truly
# comes at the end of the name
if name.endswith(action.title()): # ListView, UpdateAPIView, ThingDelete ...
name = name[:-len(action)]

if action == 'list' and not name.endswith('s'): # listThings instead of listThing
Expand Down

0 comments on commit 3bc39cf

Please sign in to comment.