File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,6 @@ for (const [schemaName, schema] of Object.entries(api.components.schemas)) {
4545 constants [ formatKey ( schemaName , 'pattern' ) ] = schema . pattern ;
4646 }
4747
48- if (
49- schema &&
50- typeof schema === 'object' &&
51- 'pattern' in schema &&
52- typeof schema . pattern === 'string'
53- ) {
54- constants [ formatKey ( schemaName , 'pattern' ) ] = schema . pattern ;
55- }
56-
5748 if (
5849 schema &&
5950 typeof schema === 'object' &&
Original file line number Diff line number Diff line change @@ -76,12 +76,14 @@ async function readOpenAPIFile(filePath: string): Promise<string> {
7676 }
7777}
7878
79+
80+ const OPENAPISPEC_SLUG_REGEX = new RegExp ( api . OPEN_APISPEC_SLUG_PATTERN ) ;
7981/**
8082 * Validate the OpenAPI specification slug.
8183 * It should match the pattern and be between the minimum and maximum length.
8284 */
8385function validateSlug ( specSlug : string ) {
84- if ( ! new RegExp ( api . OPEN_APISPEC_SLUG_PATTERN ) . test ( specSlug ) ) {
86+ if ( ! OPENAPISPEC_SLUG_REGEX . test ( specSlug ) ) {
8587 logger . error (
8688 `Invalid OpenAPI specification slug, must match pattern: ${ api . OPEN_APISPEC_SLUG_PATTERN } ` ,
8789 ) ;
You can’t perform that action at this time.
0 commit comments