Skip to content

Commit 688c89c

Browse files
WangMingHua111Manweill
authored andcommitted
refactor: classNameMode?: 'parentPath' | 'normal' | ((path: string, method: string, reqProps:IRequestMethod) => string)
1 parent 10ce265 commit 688c89c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/baseInterfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface ISwaggerOptions {
44
serviceNameSuffix?: string
55
enumNamePrefix?: string
66
methodNameMode?: 'operationId' | 'path' | 'shortOperationId' | ((reqProps: IRequestMethod) => string)
7-
classNameMode?: 'parentPath' | 'normal' | ((path: string, tag: string[]) => string)
7+
classNameMode?: 'parentPath' | 'normal' | ((path: string, method: string, reqProps:IRequestMethod) => string)
88
/** only effect classNameMode='parentPath' */
99
pathClassNameDefaultName?: string
1010
outputDir?: string

src/requestCodegen/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function requestCodegen(paths: IPaths, isV3: boolean, options: ISwaggerOp
5151
className = camelcase(className, { pascalCase: true })
5252
}
5353
} else if (typeof options.classNameMode === 'function') {
54-
className = options.classNameMode(path, reqProps.tags || [])
54+
className = options.classNameMode(path, method, reqProps)
5555
} else {
5656
if (!reqProps.tags) continue
5757
className = camelcase(RemoveSpecialCharacters(reqProps.tags[0]), { pascalCase: true })

0 commit comments

Comments
 (0)