fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2114 from hey-api/fix/validators-pattern-regex

fix(validators): do not wrap regular expression in slashes if the pattern is already wrapped

authored by

Lubos and committed by
GitHub
fda3dd3e 6d28eadf

+12 -1
+5
.changeset/five-bikes-watch.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix(validators): do not wrap regular expression in slashes if the pattern is already wrapped
+7 -1
packages/openapi-ts/src/compiler/types.ts
··· 1006 1006 }: { 1007 1007 flags?: ReadonlyArray<'g' | 'i' | 'm' | 's' | 'u' | 'y'>; 1008 1008 text: string; 1009 - }) => ts.factory.createRegularExpressionLiteral(`/${text}/${flags.join('')}`); 1009 + }) => { 1010 + const textWithSlashes = 1011 + text.startsWith('/') && text.endsWith('/') ? text : `/${text}/`; 1012 + return ts.factory.createRegularExpressionLiteral( 1013 + `${textWithSlashes}${flags.join('')}`, 1014 + ); 1015 + }; 1010 1016 1011 1017 export const createAsExpression = ({ 1012 1018 expression,