@@ -145,7 +145,6 @@ function extractEndpointsInfo(
145145 const commentLines : string [ ] = [ ] ;
146146 let paramsType : string | null = null ;
147147 let requestBodyType : string | null = null ;
148- let operationId : string | null = null ;
149148
150149 const declarations = methodProperty . getDeclarations ( ) ;
151150 if ( declarations . length <= 0 ) {
@@ -159,7 +158,7 @@ function extractEndpointsInfo(
159158
160159 const typeNode = decl . getTypeNodeOrThrow ( ) ;
161160
162- const extractOperationId = ( ) : string | null => {
161+ const operationId = ( ( ) => {
163162 if (
164163 Node . isIndexedAccessTypeNode ( typeNode ) &&
165164 typeNode . getObjectTypeNode ( ) . getText ( ) === "operations"
@@ -169,16 +168,13 @@ function extractEndpointsInfo(
169168 Node . isLiteralTypeNode ( indexTypeNode ) &&
170169 indexTypeNode . getLiteral ( ) . getKind ( ) === SyntaxKind . StringLiteral
171170 ) {
172- return indexTypeNode . getLiteral ( ) . getText ( ) . slice ( 1 , - 1 ) ;
171+ return sanitizeForOperation (
172+ indexTypeNode . getLiteral ( ) . getText ( ) . slice ( 1 , - 1 ) ,
173+ ) ;
173174 }
174175 }
175176 return null ;
176- } ;
177-
178- operationId = extractOperationId ( ) ;
179- if ( operationId !== null ) {
180- operationId = sanitizeForOperation ( operationId ) ;
181- }
177+ } ) ( ) ;
182178
183179 const paramProp = decl . getType ( ) . getPropertyOrThrow ( "parameters" ) ;
184180 const paramTypes = paramProp
@@ -338,11 +334,8 @@ function generateClientClass(
338334 bodyType,
339335 } = endpoint ;
340336
341- // Determine which operation name to use
342- let methodName = operationName ;
343- if ( options . useOperationId && operationId ) {
344- methodName = operationId ;
345- }
337+ const methodName =
338+ options . useOperationId && operationId ? operationId : operationName ;
346339
347340 // Add JSDoc comment if available
348341 if ( commentLines . length > 0 ) {
0 commit comments