From e135ea88baddc21c9fc2519adab32b02c0106a33 Mon Sep 17 00:00:00 2001 From: Matt Nawara Date: Fri, 31 Jul 2020 10:38:09 -0400 Subject: [PATCH] Pluralize list operations ending in y correctly --- 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 9774a94c7..2126b43ac 100644 --- a/rest_framework/schemas/openapi.py +++ b/rest_framework/schemas/openapi.py @@ -241,7 +241,10 @@ class AutoSchema(ViewInspector): name = name[:-len(action)] if action == 'list' and not name.endswith('s'): # listThings instead of listThing - name += 's' + if name.endswith('y'): + name = name[:-1] + 'ies' + else: + name += 's' return name