Skip to content

Commit

Permalink
refactor: classNameMode?: 'parentPath' | 'normal' | ((path: string, m…
Browse files Browse the repository at this point in the history
…ethod: string, reqProps:IRequestMethod) => string)
  • Loading branch information
WangMingHua111 authored and Manweill committed Jan 10, 2024
1 parent 10ce265 commit 688c89c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/baseInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface ISwaggerOptions {
serviceNameSuffix?: string
enumNamePrefix?: string
methodNameMode?: 'operationId' | 'path' | 'shortOperationId' | ((reqProps: IRequestMethod) => string)
classNameMode?: 'parentPath' | 'normal' | ((path: string, tag: string[]) => string)
classNameMode?: 'parentPath' | 'normal' | ((path: string, method: string, reqProps:IRequestMethod) => string)
/** only effect classNameMode='parentPath' */
pathClassNameDefaultName?: string
outputDir?: string
Expand Down
2 changes: 1 addition & 1 deletion src/requestCodegen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function requestCodegen(paths: IPaths, isV3: boolean, options: ISwaggerOp
className = camelcase(className, { pascalCase: true })
}
} else if (typeof options.classNameMode === 'function') {
className = options.classNameMode(path, reqProps.tags || [])
className = options.classNameMode(path, method, reqProps)
} else {
if (!reqProps.tags) continue
className = camelcase(RemoveSpecialCharacters(reqProps.tags[0]), { pascalCase: true })
Expand Down

0 comments on commit 688c89c

Please sign in to comment.