diff --git a/packages/core/src/routes/swagger/index.test.ts b/packages/core/src/routes/swagger/index.test.ts index eb17eb5ea..769a64fe5 100644 --- a/packages/core/src/routes/swagger/index.test.ts +++ b/packages/core/src/routes/swagger/index.test.ts @@ -72,6 +72,7 @@ describe('GET /swagger.json', () => { const testTagRouter = new Router(); testTagRouter.get('/mock', () => ({})); testTagRouter.put('/.well-known', () => ({})); + testTagRouter.put('/sso-connectors', () => ({})); const swaggerRequest = createSwaggerRequest([testTagRouter]); const response = await swaggerRequest.get('/swagger.json'); @@ -80,7 +81,10 @@ describe('GET /swagger.json', () => { get: { tags: ['Mock'] }, }, '/api/.well-known': { - put: { tags: ['Well known'] }, + put: { tags: ['Well-known'] }, + }, + '/api/sso-connectors': { + put: { tags: ['SSO connectors'] }, }, }); }); diff --git a/packages/core/src/routes/swagger/index.ts b/packages/core/src/routes/swagger/index.ts index 3eb8bfb7d..90367af59 100644 --- a/packages/core/src/routes/swagger/index.ts +++ b/packages/core/src/routes/swagger/index.ts @@ -15,6 +15,7 @@ import type { WithGuardConfig } from '#src/middleware/koa-guard.js'; import { isGuardMiddleware } from '#src/middleware/koa-guard.js'; import { isPaginationMiddleware } from '#src/middleware/koa-pagination.js'; import assertThat from '#src/utils/assert-that.js'; +import { consoleLog } from '#src/utils/console.js'; import { translationSchemas, zodTypeToSwagger } from '#src/utils/zod.js'; import type { AnonymousRouter } from '../types.js'; @@ -219,8 +220,12 @@ export default function swaggerRoutes ({ name: tag })), }; - for (const document of supplementDocuments) { - validateSupplement(baseDocument, document); + if (EnvSet.values.isUnitTest) { + consoleLog.warn('Skip validating supplement documents in unit test.'); + } else { + for (const document of supplementDocuments) { + validateSupplement(baseDocument, document); + } } const data = supplementDocuments.reduce(