try using method and path when operationId is undefined #5525

This commit is contained in:
lloydzhou
2024-09-27 13:31:07 +08:00
parent 93ff7d26cc
commit 07d089a2bd
2 changed files with 18 additions and 5 deletions

View File

@@ -377,3 +377,15 @@ export function safeLocalStorage(): {
},
};
}
export function getOperationId(operation: {
operationId?: string;
method: string;
path: string;
}) {
// pattern '^[a-zA-Z0-9_-]+$'
return (
operation?.operationId ||
`${operation.method.toUpperCase()}${operation.path.replaceAll("/", "_")}`
);
}