From 3bc39cfde6d4b3f7e50c61704cd3aa96cf304f1d Mon Sep 17 00:00:00 2001 From: peterfarrell Date: Mon, 19 Aug 2019 15:27:25 -0500 Subject: [PATCH] Fixes #6875 - OpenAPI Schema inconsistent operationId casing --- rest_framework/schemas/openapi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rest_framework/schemas/openapi.py b/rest_framework/schemas/openapi.py index 8c6a7a46e1..a94b3a81ac 100644 --- a/rest_framework/schemas/openapi.py +++ b/rest_framework/schemas/openapi.py @@ -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