From aa1fe181a1daaecb5a62f262598f3dbf5bb93815 Mon Sep 17 00:00:00 2001 From: Michael M Date: Fri, 27 Oct 2023 15:23:01 +0200 Subject: [PATCH] fix: escaped single letter ids generation --- packages/ng-openapi-gen/src/lib/utils/string.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/ng-openapi-gen/src/lib/utils/string.ts b/packages/ng-openapi-gen/src/lib/utils/string.ts index a897172..2e15750 100644 --- a/packages/ng-openapi-gen/src/lib/utils/string.ts +++ b/packages/ng-openapi-gen/src/lib/utils/string.ts @@ -60,8 +60,7 @@ export function refName(fullRef: string): string { /** Escapes the name of a property / parameter if not valid JS identifier */ export function escapeId(name: string) { - // eslint-disable-next-line unicorn/better-regex - return /^[a-zA-Z]\w+$/.test(name) ? name : `'${name.replace(/'/g, "\\'")}'`; + return /^[A-Za-z]\w*$/.test(name) ? name : `'${name.replace(/'/g, "\\'")}'`; } /** Returns the TypeScript comments for the given schema description, in a given indentation level */