···2525 /**
2626 * **REQUIRED**. This string MUST be the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions version number} of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is _not_ related to the API {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion `info.version`} string.
2727 */
2828- openapi: '3.1.0' | '3.1.1';
2828+ openapi: '3.1.0' | '3.1.1' | '3.1.2';
2929 /**
3030 * The available paths and operations for the API.
3131 */
+9-14
packages/openapi-ts/src/openApi/index.ts
···11+import { satisfies } from '../config/utils/package';
12import { IRContext } from '../ir/context';
23import type { IR } from '../ir/types';
34import type { Config } from '../types/config';
···8586 return context;
8687 }
87888888- switch (context.spec.openapi) {
8989- case '3.0.0':
9090- case '3.0.1':
9191- case '3.0.2':
9292- case '3.0.3':
9393- case '3.0.4':
9494- parseV3_0_X(context as IR.Context<OpenApi.V3_0_X>);
9595- return context;
9696- case '3.1.0':
9797- case '3.1.1':
9898- parseV3_1_X(context as IR.Context<OpenApi.V3_1_X>);
9999- return context;
100100- default:
101101- break;
8989+ if (satisfies(context.spec.openapi, '>=3.0.0 <3.1.0')) {
9090+ parseV3_0_X(context as IR.Context<OpenApi.V3_0_X>);
9191+ return context;
9292+ }
9393+9494+ if (satisfies(context.spec.openapi, '>=3.1.0')) {
9595+ parseV3_1_X(context as IR.Context<OpenApi.V3_1_X>);
9696+ return context;
10297 }
1039810499 throw new Error('Unsupported OpenAPI specification');