Skip to content

Commit 504192e

Browse files
committed
review
1 parent f72ce44 commit 504192e

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

packages/api/scripts/extract-constants.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff 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' &&

packages/cli/src/openapi/publish.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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
*/
8385
function 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
);

0 commit comments

Comments
 (0)