Skip to content

Commit 0d4b6de

Browse files
committed
add hash regex constant
1 parent 97f3e0f commit 0d4b6de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/openapi-typescript/src/transform/path-item-object.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default function transformPathItemObject(
105105
// if operationId exists, move into an `operations` export and pass the reference in here
106106
else if (operationObject.operationId) {
107107
// workaround for issue caused by redocly ref parsing: https://github.com/drwpow/openapi-typescript/issues/1542
108-
const operationId = operationObject.operationId.replace(/#/g, "/");
108+
const operationId = operationObject.operationId.replace(HASH_RE, "/");
109109
operationType = oapiRef(createRef(["operations", operationId]));
110110
injectOperationObject(
111111
operationId,
@@ -132,3 +132,5 @@ export default function transformPathItemObject(
132132

133133
return ts.factory.createTypeLiteralNode(type);
134134
}
135+
136+
const HASH_RE = /#/g;

0 commit comments

Comments
 (0)