@@ -4,6 +4,9 @@ import { isPathParam, removePrefix, isSingleResourceIdentifier } from './resourc
44const CAMEL_CASE = / [ A - Z ] ? [ a - z ] + / g;
55const CAMEL_CASE_WITH_ABBREVIATIONS = / [ A - Z ] + (? ! [ a - z ] ) | [ A - Z ] * [ a - z ] + / g;
66
7+ // List of capitalized nouns that should not be pluralized in any case.
8+ const IGNORE_LIST = [ 'Fts' ] ;
9+
710/**
811 * Returns IPA Compliant Operation ID.
912 *
@@ -40,7 +43,7 @@ export function generateOperationID(method, path) {
4043
4144 let opID = verb ;
4245 for ( let i = 0 ; i < nouns . length - 1 ; i ++ ) {
43- opID += inflection . singularize ( nouns [ i ] ) ;
46+ opID += singularize ( nouns [ i ] ) ;
4447 }
4548
4649 // singularize final noun, dependent on resource identifier - leave custom nouns alone
@@ -49,7 +52,7 @@ export function generateOperationID(method, path) {
4952 ! camelCaseCustomMethod ) ||
5053 verb === 'create'
5154 ) {
52- nouns [ nouns . length - 1 ] = inflection . singularize ( nouns [ nouns . length - 1 ] ) ;
55+ nouns [ nouns . length - 1 ] = singularize ( nouns [ nouns . length - 1 ] ) ;
5356 }
5457
5558 opID += nouns . pop ( ) ;
@@ -92,3 +95,10 @@ function deriveActionVerb(method) {
9295function capitalize ( val ) {
9396 return String ( val ) . charAt ( 0 ) . toUpperCase ( ) + String ( val ) . slice ( 1 ) ;
9497}
98+
99+ function singularize ( noun ) {
100+ if ( ! IGNORE_LIST . includes ( noun ) ) {
101+ return inflection . singularize ( noun ) ;
102+ }
103+ return noun ;
104+ }
0 commit comments