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.

feat: add spec-types package

Lubos 48527955 b198c5cb

+741 -865
+5
.changeset/green-shoes-wish.md
··· 1 + --- 2 + "@hey-api/spec-types": minor 3 + --- 4 + 5 + **feat**: initial release
+6
.changeset/yellow-eagles-stare.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + "@hey-api/shared": patch 4 + --- 5 + 6 + **internal**: add `@hey-api/spec-types` dependency
+1
packages/openapi-python/package.json
··· 63 63 "@hey-api/codegen-core": "workspace:*", 64 64 "@hey-api/json-schema-ref-parser": "workspace:*", 65 65 "@hey-api/shared": "workspace:*", 66 + "@hey-api/spec-types": "workspace:*", 66 67 "@hey-api/types": "workspace:*", 67 68 "ansi-colors": "4.1.3", 68 69 "color-support": "1.1.3",
+2 -1
packages/openapi-python/src/plugins/@hey-api/sdk/examples/types.ts
··· 1 - import type { FeatureToggle, IR, LinguistLanguages } from '@hey-api/shared'; 1 + import type { FeatureToggle, IR } from '@hey-api/shared'; 2 + import type { LinguistLanguages } from '@hey-api/spec-types'; 2 3 import type { MaybeFunc } from '@hey-api/types'; 3 4 4 5 import type { CallArgs, DollarPyDsl, ExampleOptions } from '../../../../py-dsl';
+1
packages/openapi-ts/package.json
··· 72 72 "@hey-api/codegen-core": "workspace:*", 73 73 "@hey-api/json-schema-ref-parser": "workspace:*", 74 74 "@hey-api/shared": "workspace:*", 75 + "@hey-api/spec-types": "workspace:*", 75 76 "@hey-api/types": "workspace:*", 76 77 "ansi-colors": "4.1.3", 77 78 "color-support": "1.1.3",
+17 -25
packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts
··· 1 - import type { 2 - Context, 3 - OpenApi, 4 - OpenApiV2_0_XTypes, 5 - OpenApiV3_0_XTypes, 6 - OpenApiV3_1_XTypes, 7 - } from '@hey-api/shared'; 1 + import type { Context, OpenApi } from '@hey-api/shared'; 8 2 import { satisfies } from '@hey-api/shared'; 3 + import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@hey-api/spec-types'; 9 4 10 5 import { $ } from '../../../ts-dsl'; 11 6 import type { HeyApiSchemasPlugin } from './types'; ··· 15 10 schema, 16 11 }: { 17 12 plugin: HeyApiSchemasPlugin['Instance']; 18 - schema: 19 - | OpenApiV2_0_XTypes['SchemaObject'] 20 - | OpenApiV3_0_XTypes['SchemaObject'] 21 - | OpenApiV3_1_XTypes['SchemaObject']; 13 + schema: OpenAPIV2.SchemaObject | OpenAPIV3.SchemaObject | OpenAPIV3_1.SchemaObject; 22 14 }) => { 23 15 if (plugin.config.type === 'form') { 24 16 if (schema.description) { ··· 50 42 }: { 51 43 context: Context; 52 44 plugin: HeyApiSchemasPlugin['Instance']; 53 - schema: OpenApiV2_0_XTypes['SchemaObject']; 54 - }): OpenApiV2_0_XTypes['SchemaObject'] => { 45 + schema: OpenAPIV2.SchemaObject; 46 + }): OpenAPIV2.SchemaObject => { 55 47 if (Array.isArray(_schema)) { 56 48 return _schema.map((item) => 57 49 schemaToJsonSchemaDraft_04({ ··· 59 51 plugin, 60 52 schema: item, 61 53 }), 62 - ) as unknown as OpenApiV2_0_XTypes['SchemaObject']; 54 + ) as unknown as OpenAPIV2.SchemaObject; 63 55 } 64 56 65 57 const schema = structuredClone(_schema); ··· 95 87 schema.items = schemaToJsonSchemaDraft_04({ 96 88 context, 97 89 plugin, 98 - schema: schema.items as OpenApiV2_0_XTypes['SchemaObject'], 90 + schema: schema.items as OpenAPIV2.SchemaObject, 99 91 }); 100 92 } 101 93 ··· 123 115 }: { 124 116 context: Context; 125 117 plugin: HeyApiSchemasPlugin['Instance']; 126 - schema: OpenApiV3_0_XTypes['SchemaObject'] | OpenApiV3_0_XTypes['ReferenceObject']; 127 - }): OpenApiV3_0_XTypes['SchemaObject'] | OpenApiV3_0_XTypes['ReferenceObject'] => { 118 + schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; 119 + }): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject => { 128 120 if (Array.isArray(_schema)) { 129 121 return _schema.map((item) => 130 122 schemaToJsonSchemaDraft_05({ ··· 132 124 plugin, 133 125 schema: item, 134 126 }), 135 - ) as unknown as OpenApiV3_0_XTypes['SchemaObject'] | OpenApiV3_0_XTypes['ReferenceObject']; 127 + ) as unknown as OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; 136 128 } 137 129 138 130 const schema = structuredClone(_schema); ··· 216 208 }: { 217 209 context: Context; 218 210 plugin: HeyApiSchemasPlugin['Instance']; 219 - schema: OpenApiV3_1_XTypes['SchemaObject']; 220 - }): OpenApiV3_1_XTypes['SchemaObject'] => { 211 + schema: OpenAPIV3_1.SchemaObject; 212 + }): OpenAPIV3_1.SchemaObject => { 221 213 if (Array.isArray(_schema)) { 222 214 return _schema.map((item) => 223 215 schemaToJsonSchema2020_12({ ··· 225 217 plugin, 226 218 schema: item, 227 219 }), 228 - ) as unknown as OpenApiV3_1_XTypes['SchemaObject']; 220 + ) as unknown as OpenAPIV3_1.SchemaObject; 229 221 } 230 222 231 223 const schema = structuredClone(_schema); ··· 319 311 name: string; 320 312 plugin: HeyApiSchemasPlugin['Instance']; 321 313 schema: 322 - | OpenApiV2_0_XTypes['SchemaObject'] 323 - | OpenApiV3_0_XTypes['ReferenceObject'] 324 - | OpenApiV3_0_XTypes['SchemaObject'] 325 - | OpenApiV3_1_XTypes['SchemaObject']; 314 + | OpenAPIV2.SchemaObject 315 + | OpenAPIV3.ReferenceObject 316 + | OpenAPIV3.SchemaObject 317 + | OpenAPIV3_1.SchemaObject; 326 318 }): string => { 327 319 let customName = ''; 328 320
+6 -11
packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts
··· 1 - import type { 2 - DefinePlugin, 3 - OpenApiV2_0_XTypes, 4 - OpenApiV3_0_XTypes, 5 - OpenApiV3_1_XTypes, 6 - Plugin, 7 - } from '@hey-api/shared'; 1 + import type { DefinePlugin, Plugin } from '@hey-api/shared'; 2 + import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@hey-api/spec-types'; 8 3 9 4 export type UserConfig = Plugin.Name<'@hey-api/schemas'> & 10 5 Plugin.Hooks & ··· 21 16 | (( 22 17 name: string, 23 18 schema: 24 - | OpenApiV2_0_XTypes['SchemaObject'] 25 - | OpenApiV3_0_XTypes['ReferenceObject'] 26 - | OpenApiV3_0_XTypes['SchemaObject'] 27 - | OpenApiV3_1_XTypes['SchemaObject'], 19 + | OpenAPIV2.SchemaObject 20 + | OpenAPIV3.ReferenceObject 21 + | OpenAPIV3.SchemaObject 22 + | OpenAPIV3_1.SchemaObject, 28 23 ) => string); 29 24 /** 30 25 * Choose schema type to generate. Select 'form' if you don't want
+2 -1
packages/openapi-ts/src/plugins/@hey-api/sdk/examples/types.ts
··· 1 - import type { FeatureToggle, IR, LinguistLanguages } from '@hey-api/shared'; 1 + import type { FeatureToggle, IR } from '@hey-api/shared'; 2 + import type { LinguistLanguages } from '@hey-api/spec-types'; 2 3 import type { MaybeFunc } from '@hey-api/types'; 3 4 4 5 import type { CallArgs, DollarTsDsl, ExampleOptions } from '../../../../ts-dsl';
+1
packages/shared/package.json
··· 42 42 "dependencies": { 43 43 "@hey-api/codegen-core": "workspace:*", 44 44 "@hey-api/json-schema-ref-parser": "workspace:*", 45 + "@hey-api/spec-types": "workspace:*", 45 46 "@hey-api/types": "workspace:*", 46 47 "ansi-colors": "4.1.3", 47 48 "cross-spawn": "7.0.6",
-8
packages/shared/src/index.ts
··· 79 79 } from './ir/types'; 80 80 export { addItemsToSchema } from './ir/utils'; 81 81 export { parseOpenApiSpec } from './openApi'; 82 - export type { OpenApiV2_0_X, OpenApiV2_0_XTypes } from './openApi/2.0.x'; 83 82 export { parseV2_0_X } from './openApi/2.0.x'; 84 - export type { OpenApiV3_0_X, OpenApiV3_0_XTypes } from './openApi/3.0.x'; 85 83 export { parseV3_0_X } from './openApi/3.0.x'; 86 - export type { OpenApiV3_1_X, OpenApiV3_1_XTypes } from './openApi/3.1.x'; 87 84 export { parseV3_1_X } from './openApi/3.1.x'; 88 85 export type { OperationsStrategy } from './openApi/shared/locations'; 89 86 export type { OperationPathStrategy, OperationStructureStrategy } from './openApi/shared/locations'; 90 87 export { OperationPath, OperationStrategy } from './openApi/shared/locations'; 91 - export type { 92 - CodeSampleObject, 93 - EnumExtensions, 94 - LinguistLanguages, 95 - } from './openApi/shared/types/openapi-spec-extensions'; 96 88 export { buildGraph } from './openApi/shared/utils/graph'; 97 89 export { patchOpenApiSpec } from './openApi/shared/utils/patch'; 98 90 export type {
+1 -1
packages/shared/src/ir/intents.ts
··· 1 + import type { CodeSampleObject } from '@hey-api/spec-types'; 1 2 import type { MaybePromise } from '@hey-api/types'; 2 3 3 - import type { CodeSampleObject } from '..//openApi/shared/types'; 4 4 import type { IR } from './types'; 5 5 6 6 export interface ExampleIntent {
+10 -24
packages/shared/src/ir/types.ts
··· 1 1 /* eslint-disable @typescript-eslint/no-namespace */ 2 2 import type { Symbol } from '@hey-api/codegen-core'; 3 + import type { JSONSchemaDraft2020_12, OpenAPIExtensions, OpenAPIV3_1 } from '@hey-api/spec-types'; 3 4 4 - import type { JsonSchemaDraft2020_12 } from '../openApi/3.1.x/types/json-schema-draft-2020-12'; 5 - import type { 6 - ReferenceObject as IRReferenceObject, 7 - SecuritySchemeObject, 8 - ServerObject, 9 - } from '../openApi/3.1.x/types/spec'; 10 5 import type { IRMediaType } from './mediaType'; 11 - 12 - /** 13 - * OpenAPI Specification Extensions. 14 - * 15 - * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 16 - */ 17 - export interface SpecificationExtensions { 18 - [extension: `x-${string}`]: unknown; 19 - } 20 6 21 7 interface IRBodyObject { 22 8 mediaType: string; ··· 36 22 schemas?: Record<string, IRSchemaObject>; 37 23 } 38 24 39 - export interface IROperationObject extends SpecificationExtensions { 25 + export interface IROperationObject extends OpenAPIExtensions { 40 26 body?: IRBodyObject; 41 27 deprecated?: boolean; 42 28 description?: string; ··· 60 46 } 61 47 62 48 export interface IRParameterObject 63 - extends Pick<JsonSchemaDraft2020_12, 'deprecated' | 'description'>, SpecificationExtensions { 49 + extends Pick<JSONSchemaDraft2020_12.Document, 'deprecated' | 'description'>, OpenAPIExtensions { 64 50 /** 65 51 * Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of `contentType` (implicit or explicit) SHALL be ignored. 66 52 */ ··· 102 88 trace?: IROperationObject; 103 89 } 104 90 105 - interface IRRequestBodyObject extends Pick<JsonSchemaDraft2020_12, 'description'> { 91 + interface IRRequestBodyObject extends Pick<JSONSchemaDraft2020_12.Document, 'description'> { 106 92 required?: boolean; 107 93 schema: IRSchemaObject; 108 94 } ··· 127 113 export interface IRSchemaObject 128 114 extends 129 115 Pick< 130 - JsonSchemaDraft2020_12, 116 + JSONSchemaDraft2020_12.Document, 131 117 | '$ref' 132 118 | 'const' 133 119 | 'default' ··· 146 132 | 'title' 147 133 | 'example' 148 134 >, 149 - SpecificationExtensions { 135 + OpenAPIExtensions { 150 136 /** 151 137 * If the schema is intended to be used as an object property, it can be 152 138 * marked as read-only or write-only. This value controls whether the schema ··· 162 148 /** 163 149 * Any string value is accepted as `format`. 164 150 */ 165 - format?: JsonSchemaDraft2020_12['format'] | 'binary' | 'integer'; 151 + format?: JSONSchemaDraft2020_12.Document['format'] | 'binary' | 'integer'; 166 152 /** 167 153 * If schema resolves into multiple items instead of a simple `type`, they 168 154 * will be included in `items` array. ··· 219 205 | 'void'; 220 206 } 221 207 222 - type IRSecurityObject = SecuritySchemeObject; 208 + type IRSecurityObject = OpenAPIV3_1.SecuritySchemeObject; 223 209 224 210 // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Interface rather than type alias avoids TS4023 errors when bundled dist is consumed by tsgo/TypeScript 7 225 - export interface IRServerObject extends ServerObject {} 211 + export interface IRServerObject extends OpenAPIV3_1.ServerObject {} 226 212 227 213 type IRWebhookObject = IRPathItemObject; 228 214 ··· 242 228 export type ParametersObject = IRParametersObject; 243 229 export type PathItemObject = IRPathItemObject; 244 230 export type PathsObject = IRPathsObject; 245 - export type ReferenceObject = IRReferenceObject; 231 + export type ReferenceObject = OpenAPIV3_1.ReferenceObject; 246 232 export type RequestBodyObject = IRRequestBodyObject; 247 233 export type ResponseObject = IRResponseObject; 248 234 export type ResponsesObject = IRResponsesObject;
-9
packages/shared/src/openApi/2.0.x/index.ts
··· 1 1 export { parseV2_0_X } from './parser'; 2 - export type { OpenApiV2_0_X } from './types/spec'; 3 - 4 - import type { InfoObject, OperationObject, SchemaObject } from './types/spec'; 5 - 6 - export interface OpenApiV2_0_XTypes { 7 - InfoObject: InfoObject; 8 - OperationObject: OperationObject; 9 - SchemaObject: SchemaObject; 10 - }
+9 -8
packages/shared/src/openApi/2.0.x/parser/__tests__/operation.test.ts
··· 1 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../../ir/context'; 2 - import type { ParameterObject, SecuritySchemeObject } from '../../types/spec'; 3 4 import { parsePathOperation } from '../operation'; 4 5 5 6 type ParseOperationProps = Parameters<typeof parsePathOperation>[0]; ··· 48 49 summary: 'Test Operation', 49 50 }; 50 51 const path = '/test'; 51 - const securitySchemesMap = new Map<string, SecuritySchemeObject>([ 52 + const securitySchemesMap = new Map<string, OpenAPIV2.SecuritySchemeObject>([ 52 53 ['apiKeyAuth', { in: 'header', name: 'Auth', type: 'apiKey' }], 53 54 ['basicAuthRule', { description: 'Basic Auth', type: 'basic' }], 54 55 [ ··· 107 108 it('should parse body parameter when consumes is undefined', () => { 108 109 const context = createContext(); 109 110 const method = 'post'; 110 - const bodyParam: ParameterObject = { 111 + const bodyParam: OpenAPIV2.ParameterObject = { 111 112 description: 'Request body', 112 113 in: 'body', 113 114 name: 'body', ··· 132 133 summary: 'Create an item', 133 134 }; 134 135 const path = '/items'; 135 - const securitySchemesMap = new Map<string, SecuritySchemeObject>(); 136 + const securitySchemesMap = new Map<string, OpenAPIV2.SecuritySchemeObject>(); 136 137 const state: ParseOperationProps['state'] = { 137 138 ids: new Map<string, string>(), 138 139 }; ··· 157 158 it('should parse body parameter with array schema', () => { 158 159 const context = createContext(); 159 160 const method = 'post'; 160 - const bodyParam: ParameterObject = { 161 + const bodyParam: OpenAPIV2.ParameterObject = { 161 162 description: 'add items', 162 163 in: 'body', 163 164 name: 'request', ··· 183 184 }, 184 185 }; 185 186 const path = '/api/v1/items'; 186 - const securitySchemesMap = new Map<string, SecuritySchemeObject>(); 187 + const securitySchemesMap = new Map<string, OpenAPIV2.SecuritySchemeObject>(); 187 188 const state: ParseOperationProps['state'] = { 188 189 ids: new Map<string, string>(), 189 190 }; ··· 208 209 it('should use consumes when specified', () => { 209 210 const context = createContext(); 210 211 const method = 'post'; 211 - const bodyParam: ParameterObject = { 212 + const bodyParam: OpenAPIV2.ParameterObject = { 212 213 description: 'XML body', 213 214 in: 'body', 214 215 name: 'body', ··· 228 229 }, 229 230 }; 230 231 const path = '/items'; 231 - const securitySchemesMap = new Map<string, SecuritySchemeObject>(); 232 + const securitySchemesMap = new Map<string, OpenAPIV2.SecuritySchemeObject>(); 232 233 const state: ParseOperationProps['state'] = { 233 234 ids: new Map<string, string>(), 234 235 };
+5 -5
packages/shared/src/openApi/2.0.x/parser/filter.ts
··· 1 1 import type { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 3 3 4 import { createOperationKey } from '../../../ir/operation'; 4 5 import { addNamespace, removeNamespace } from '../../../openApi/shared/utils/filter'; 5 6 import { httpMethods } from '../../../openApi/shared/utils/operation'; 6 - import type { OpenApiV2_0_X, OperationObject, PathItemObject, PathsObject } from '../types/spec'; 7 7 8 8 /** 9 9 * Replace source spec with filtered version. ··· 22 22 requestBodies: Set<string>; 23 23 responses: Set<string>; 24 24 schemas: Set<string>; 25 - spec: OpenApiV2_0_X; 25 + spec: OpenAPIV2.Document; 26 26 }) => { 27 27 const eventFilterSpec = logger.timeEvent('filter-spec'); 28 28 if (spec.definitions) { ··· 49 49 50 50 if (spec.paths) { 51 51 for (const entry of Object.entries(spec.paths)) { 52 - const path = entry[0] as keyof PathsObject; 53 - const pathItem = entry[1] as PathItemObject; 52 + const path = entry[0] as keyof OpenAPIV2.PathsObject; 53 + const pathItem = entry[1] as OpenAPIV2.PathItemObject; 54 54 55 55 for (const method of httpMethods) { 56 56 // @ts-expect-error 57 - const operation = pathItem[method] as OperationObject; 57 + const operation = pathItem[method] as OpenAPIV2.OperationObject; 58 58 if (!operation) { 59 59 continue; 60 60 }
+8 -16
packages/shared/src/openApi/2.0.x/parser/index.ts
··· 1 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { buildResourceMetadata } from '../../../openApi/shared/graph/meta'; 3 5 import { transformOpenApiSpec } from '../../../openApi/shared/transforms'; ··· 10 12 import { buildGraph } from '../../../openApi/shared/utils/graph'; 11 13 import { mergeParametersObjects } from '../../../openApi/shared/utils/parameter'; 12 14 import { handleValidatorResult } from '../../../openApi/shared/utils/validator'; 13 - import type { 14 - OpenApiV2_0_X, 15 - OperationObject, 16 - PathItemObject, 17 - PathsObject, 18 - SecuritySchemeObject, 19 - } from '../types/spec'; 20 15 import { filterSpec } from './filter'; 21 16 import { parsePathOperation } from './operation'; 22 17 import { parametersArrayToObject } from './parameter'; ··· 24 19 import { parseServers } from './server'; 25 20 import { validateOpenApiSpec } from './validate'; 26 21 27 - type PathKeys<T extends keyof PathsObject = keyof PathsObject> = keyof T extends infer K 28 - ? K extends `/${string}` 29 - ? K 30 - : never 31 - : never; 22 + type PathKeys<T extends keyof OpenAPIV2.PathsObject = keyof OpenAPIV2.PathsObject> = 23 + keyof T extends infer K ? (K extends `/${string}` ? K : never) : never; 32 24 33 - export const parseV2_0_X = (context: Context<OpenApiV2_0_X>) => { 25 + export const parseV2_0_X = (context: Context<OpenAPIV2.Document>) => { 34 26 if (context.config.parser.validate_EXPERIMENTAL) { 35 27 const result = validateOpenApiSpec(context.spec, context.logger); 36 28 handleValidatorResult({ context, result }); ··· 59 51 const state: State = { 60 52 ids: new Map(), 61 53 }; 62 - const securitySchemesMap = new Map<string, SecuritySchemeObject>(); 54 + const securitySchemesMap = new Map<string, OpenAPIV2.SecuritySchemeObject>(); 63 55 64 56 for (const name in context.spec.securityDefinitions) { 65 57 const securitySchemeObject = context.spec.securityDefinitions[name]!; ··· 87 79 88 80 const finalPathItem = pathItem.$ref 89 81 ? { 90 - ...context.resolveRef<PathItemObject>(pathItem.$ref), 82 + ...context.resolveRef<OpenAPIV2.PathItemObject>(pathItem.$ref), 91 83 ...pathItem, 92 84 } 93 85 : pathItem; 94 86 95 - const commonOperation: OperationObject = { 87 + const commonOperation: OpenAPIV2.OperationObject = { 96 88 consumes: context.spec.consumes, 97 89 produces: context.spec.produces, 98 90 responses: {},
+9 -4
packages/shared/src/openApi/2.0.x/parser/mediaType.ts
··· 1 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 + 1 3 import type { IRMediaType } from '../../../ir/mediaType'; 2 4 import { isMediaTypeFileLike, mediaTypeToIrMediaType } from '../../../ir/mediaType'; 3 - import type { ReferenceObject, ResponseObject, SchemaObject } from '../types/spec'; 4 5 5 6 interface Content { 6 7 mediaType: string; 7 - schema: SchemaObject | ReferenceObject | undefined; 8 + schema: OpenAPIV2.SchemaObject | OpenAPIV2.ReferenceObject | undefined; 8 9 type: IRMediaType | undefined; 9 10 } 10 11 11 - export const contentToSchema = ({ content }: { content: Content }): SchemaObject | undefined => { 12 + export const contentToSchema = ({ 13 + content, 14 + }: { 15 + content: Content; 16 + }): OpenAPIV2.SchemaObject | undefined => { 12 17 const { mediaType, schema } = content; 13 18 14 19 if (schema && '$ref' in schema) { ··· 42 47 response, 43 48 }: { 44 49 mimeTypes: ReadonlyArray<string> | undefined; 45 - response: Pick<ResponseObject, 'schema'>; 50 + response: Pick<OpenAPIV2.ResponseObject, 'schema'>; 46 51 }): ReadonlyArray<Content> => { 47 52 const objects: Array<Content> = []; 48 53
+12 -17
packages/shared/src/openApi/2.0.x/parser/operation.ts
··· 1 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import type { State } from '../../../openApi/shared/types/state'; 4 6 import { operationToId } from '../../../openApi/shared/utils/operation'; 5 - import type { 6 - OperationObject, 7 - ParameterObject, 8 - PathItemObject, 9 - ResponseObject, 10 - SchemaObject, 11 - SecuritySchemeObject, 12 - } from '../types/spec'; 13 7 import { contentToSchema, mediaTypeObjects } from './mediaType'; 14 8 import { paginationField } from './pagination'; 15 9 import { parseExtensions, schemaToIrSchema } from './schema'; 16 10 17 11 interface Operation 18 - extends Omit<OperationObject, 'parameters'>, Pick<IR.OperationObject, 'parameters'> { 19 - requestBody?: OperationObject['parameters']; 12 + extends Omit<OpenAPIV2.OperationObject, 'parameters'>, Pick<IR.OperationObject, 'parameters'> { 13 + requestBody?: OpenAPIV2.OperationObject['parameters']; 20 14 } 21 15 22 16 const parseOperationJsDoc = ({ ··· 93 87 }: Pick<IR.OperationObject, 'method' | 'path'> & { 94 88 context: Context; 95 89 operation: Operation; 96 - securitySchemesMap: Map<string, SecuritySchemeObject>; 90 + securitySchemesMap: Map<string, OpenAPIV2.SecuritySchemeObject>; 97 91 state: State; 98 92 }): IR.OperationObject => { 99 93 const irOperation = initIrOperation({ ··· 121 115 122 116 // Check if there are any body parameters (not formData) to determine default media type 123 117 const hasBodyParameter = operation.requestBody?.some((param) => { 124 - const resolvedParam = '$ref' in param ? context.resolveRef<ParameterObject>(param.$ref) : param; 118 + const resolvedParam = 119 + '$ref' in param ? context.resolveRef<OpenAPIV2.ParameterObject>(param.$ref) : param; 125 120 return resolvedParam.in === 'body'; 126 121 }); 127 122 128 123 for (const requestBodyParameter of operation.requestBody ?? []) { 129 124 const requestBody = 130 125 '$ref' in requestBodyParameter 131 - ? context.resolveRef<ParameterObject>(requestBodyParameter.$ref) 126 + ? context.resolveRef<OpenAPIV2.ParameterObject>(requestBodyParameter.$ref) 132 127 : requestBodyParameter; 133 - const schema: SchemaObject = 128 + const schema: OpenAPIV2.SchemaObject = 134 129 requestBody.in === 'body' 135 130 ? requestBody.schema 136 131 : { ··· 242 237 243 238 const response = operation.responses[name]!; 244 239 const responseObject = 245 - '$ref' in response ? context.resolveRef<ResponseObject>(response.$ref) : response; 240 + '$ref' in response ? context.resolveRef<OpenAPIV2.ResponseObject>(response.$ref) : response; 246 241 const contents = mediaTypeObjects({ 247 242 // assume JSON by default 248 243 mimeTypes: operation.produces ? operation.produces : ['application/json'], ··· 365 360 }: { 366 361 context: Context; 367 362 method: Extract< 368 - keyof PathItemObject, 363 + keyof OpenAPIV2.PathItemObject, 369 364 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace' 370 365 >; 371 366 operation: Operation; 372 367 path: keyof IR.PathsObject; 373 - securitySchemesMap: Map<string, SecuritySchemeObject>; 368 + securitySchemesMap: Map<string, OpenAPIV2.SecuritySchemeObject>; 374 369 state: State; 375 370 }) => { 376 371 if (!context.ir.paths) {
+9 -7
packages/shared/src/openApi/2.0.x/parser/pagination.ts
··· 1 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { getPaginationKeywordsRegExp } from '../../../ir/pagination'; 3 5 import type { SchemaType } from '../../../openApi/shared/types/schema'; 4 - import type { ParameterObject, ReferenceObject } from '../types/spec'; 5 - import type { SchemaObject } from '../types/spec'; 6 6 import { getSchemaType } from './schema'; 7 7 8 - const isPaginationType = (schemaType: SchemaType<SchemaObject> | undefined): boolean => 8 + const isPaginationType = (schemaType: SchemaType<OpenAPIV2.SchemaObject> | undefined): boolean => 9 9 schemaType === 'boolean' || 10 10 schemaType === 'integer' || 11 11 schemaType === 'number' || ··· 20 20 context: Context; 21 21 name: string; 22 22 schema: 23 - | ParameterObject 24 - | SchemaObject 25 - | ReferenceObject 23 + | OpenAPIV2.ParameterObject 24 + | OpenAPIV2.SchemaObject 25 + | OpenAPIV2.ReferenceObject 26 26 | { 27 27 in: undefined; 28 28 }; ··· 33 33 } 34 34 35 35 if ('$ref' in schema) { 36 - const ref = context.resolveRef<ParameterObject | SchemaObject>(schema.$ref ?? ''); 36 + const ref = context.resolveRef<OpenAPIV2.ParameterObject | OpenAPIV2.SchemaObject>( 37 + schema.$ref ?? '', 38 + ); 37 39 38 40 if ('in' in ref && ref.in) { 39 41 const refSchema =
+9 -13
packages/shared/src/openApi/2.0.x/parser/parameter.ts
··· 1 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 - import type { 4 - OperationObject, 5 - ParameterObject, 6 - ReferenceObject, 7 - SchemaObject, 8 - } from '../types/spec'; 9 5 import { paginationField } from './pagination'; 10 6 import { parseExtensions, schemaToIrSchema } from './schema'; 11 7 12 - type Parameter = Exclude<ParameterObject, { in: 'body' }>; 8 + type Parameter = Exclude<OpenAPIV2.ParameterObject, { in: 'body' }>; 13 9 14 10 /** 15 11 * Returns default parameter `explode` based on value of `collectionFormat`. ··· 47 43 parameters, 48 44 }: { 49 45 context: Context; 50 - operation: OperationObject; 51 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 46 + operation: OpenAPIV2.OperationObject; 47 + parameters?: ReadonlyArray<OpenAPIV2.ParameterObject | OpenAPIV2.ReferenceObject>; 52 48 }): IR.ParametersObject | undefined => { 53 49 if (!parameters || !Object.keys(parameters).length) { 54 50 return; ··· 59 55 for (const parameterOrReference of parameters) { 60 56 const parameter = 61 57 '$ref' in parameterOrReference 62 - ? context.dereference<ParameterObject>(parameterOrReference) 58 + ? context.dereference<OpenAPIV2.ParameterObject>(parameterOrReference) 63 59 : parameterOrReference; 64 60 65 61 // push request body parameters into a separate field ··· 101 97 }): IR.ParameterObject => { 102 98 const schema = parameter; 103 99 104 - const finalSchema: SchemaObject = 100 + const finalSchema: OpenAPIV2.SchemaObject = 105 101 schema && '$ref' in schema 106 102 ? { 107 103 allOf: [ ··· 109 105 ...schema, 110 106 $ref: schema.$ref as string, 111 107 required: Array.isArray(schema.required) ? schema.required : [], 112 - type: schema.type as SchemaObject['type'], 108 + type: schema.type as OpenAPIV2.SchemaObject['type'], 113 109 }, 114 110 ], 115 111 description: parameter.description, ··· 118 114 description: parameter.description, 119 115 ...schema, 120 116 required: Array.isArray(schema.required) ? schema.required : [], 121 - type: schema.type as SchemaObject['type'], 117 + type: schema.type as OpenAPIV2.SchemaObject['type'], 122 118 }; 123 119 124 120 const pagination = paginationField({
+30 -29
packages/shared/src/openApi/2.0.x/parser/schema.ts
··· 1 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import { addItemsToSchema } from '../../../ir/utils'; ··· 8 10 } from '../../../openApi/shared/types/schema'; 9 11 import { discriminatorValues } from '../../../openApi/shared/utils/discriminator'; 10 12 import { isTopLevelComponent, refToName } from '../../../utils/ref'; 11 - import type { SchemaObject } from '../types/spec'; 12 13 13 14 export const getSchemaType = ({ 14 15 schema, 15 16 }: { 16 - schema: SchemaObject; 17 - }): SchemaType<SchemaObject> | undefined => { 17 + schema: OpenAPIV2.SchemaObject; 18 + }): SchemaType<OpenAPIV2.SchemaObject> | undefined => { 18 19 if (schema.type) { 19 20 return schema.type; 20 21 } ··· 32 33 schema, 33 34 }: { 34 35 irSchema: IR.SchemaObject; 35 - schema: SchemaObject; 36 + schema: OpenAPIV2.SchemaObject; 36 37 }) => { 37 38 if (schema.example) { 38 39 irSchema.example = schema.example; ··· 52 53 schema, 53 54 }: { 54 55 irSchema: IR.SchemaObject; 55 - schema: SchemaObject; 56 + schema: OpenAPIV2.SchemaObject; 56 57 }) => { 57 58 if (schema.default !== undefined) { 58 59 irSchema.default = schema.default; ··· 111 112 }: { 112 113 context: Context; 113 114 irSchema?: IR.SchemaObject; 114 - schema: SchemaObject; 115 + schema: OpenAPIV2.SchemaObject; 115 116 state: SchemaState; 116 117 }): IR.SchemaObject => { 117 118 if (schema.maxItems && schema.maxItems === schema.minItems) { ··· 162 163 }: { 163 164 context: Context; 164 165 irSchema?: IR.SchemaObject; 165 - schema: SchemaObject; 166 + schema: OpenAPIV2.SchemaObject; 166 167 state: SchemaState; 167 168 }): IR.SchemaObject => { 168 169 irSchema.type = 'boolean'; ··· 176 177 }: { 177 178 context: Context; 178 179 irSchema?: IR.SchemaObject; 179 - schema: SchemaWithRequired<SchemaObject, 'type'>; 180 + schema: SchemaWithRequired<OpenAPIV2.SchemaObject, 'type'>; 180 181 state: SchemaState; 181 182 }): IR.SchemaObject => { 182 183 irSchema.type = schema.type; ··· 192 193 }: { 193 194 context: Context; 194 195 irSchema?: IR.SchemaObject; 195 - schema: SchemaObject; 196 + schema: OpenAPIV2.SchemaObject; 196 197 state: SchemaState; 197 198 }): IR.SchemaObject => { 198 199 irSchema.type = 'object'; ··· 257 258 }: { 258 259 context: Context; 259 260 irSchema?: IR.SchemaObject; 260 - schema: SchemaObject; 261 + schema: OpenAPIV2.SchemaObject; 261 262 state: SchemaState; 262 263 }): IR.SchemaObject => { 263 264 irSchema.type = 'string'; ··· 273 274 } 274 275 }; 275 276 276 - const initIrSchema = ({ schema }: { schema: SchemaObject }): IR.SchemaObject => { 277 + const initIrSchema = ({ schema }: { schema: OpenAPIV2.SchemaObject }): IR.SchemaObject => { 277 278 const irSchema: IR.SchemaObject = {}; 278 279 279 280 parseSchemaJsDoc({ ··· 295 296 state, 296 297 }: { 297 298 context: Context; 298 - schema: SchemaWithRequired<SchemaObject, 'allOf'>; 299 + schema: SchemaWithRequired<OpenAPIV2.SchemaObject, 'allOf'>; 299 300 state: SchemaState; 300 301 }): IR.SchemaObject => { 301 302 let irSchema = initIrSchema({ schema }); ··· 332 333 schemaItems.push(irCompositionSchema); 333 334 334 335 if (compositionSchema.$ref) { 335 - const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref); 336 + const ref = context.resolveRef<OpenAPIV2.SchemaObject>(compositionSchema.$ref); 336 337 // `$ref` should be passed from the root `parseSchema()` call 337 338 if (ref.discriminator && state.$ref) { 338 339 const values = discriminatorValues(state.$ref); ··· 376 377 for (const compositionSchema of compositionSchemas) { 377 378 // TODO: parser - this could be probably resolved more accurately 378 379 const finalCompositionSchema = compositionSchema.$ref 379 - ? context.resolveRef<SchemaObject>(compositionSchema.$ref) 380 + ? context.resolveRef<OpenAPIV2.SchemaObject>(compositionSchema.$ref) 380 381 : compositionSchema; 381 382 382 383 if (getSchemaType({ schema: finalCompositionSchema }) === 'object') { ··· 448 449 state, 449 450 }: { 450 451 context: Context; 451 - schema: SchemaWithRequired<SchemaObject, 'enum'>; 452 + schema: SchemaWithRequired<OpenAPIV2.SchemaObject, 'enum'>; 452 453 state: SchemaState; 453 454 }): IR.SchemaObject => { 454 455 let irSchema = initIrSchema({ schema }); ··· 459 460 460 461 for (const [index, enumValue] of schema.enum.entries()) { 461 462 const typeOfEnumValue = typeof enumValue; 462 - let enumType: SchemaType<SchemaObject> | 'null' | undefined; 463 + let enumType: SchemaType<OpenAPIV2.SchemaObject> | 'null' | undefined; 463 464 464 465 if ( 465 466 typeOfEnumValue === 'string' || ··· 525 526 state, 526 527 }: { 527 528 context: Context; 528 - schema: SchemaWithRequired<SchemaObject, '$ref'>; 529 + schema: SchemaWithRequired<OpenAPIV2.SchemaObject, '$ref'>; 529 530 state: SchemaState; 530 531 }): IR.SchemaObject => { 531 532 const irSchema: IR.SchemaObject = {}; ··· 534 535 const isComponentsRef = isTopLevelComponent(schema.$ref); 535 536 if (!isComponentsRef) { 536 537 if (!state.circularReferenceTracker.has(schema.$ref)) { 537 - const refSchema = context.resolveRef<SchemaObject>(schema.$ref); 538 + const refSchema = context.resolveRef<OpenAPIV2.SchemaObject>(schema.$ref); 538 539 const originalRef = state.$ref; 539 540 state.$ref = schema.$ref; 540 541 const irSchema = schemaToIrSchema({ ··· 557 558 irSchema.$ref = irSchema.$ref.replace(/#\/definitions\/([^/]+)/g, '#/components/schemas/$1'); 558 559 559 560 if (!state.circularReferenceTracker.has(schema.$ref)) { 560 - const refSchema = context.resolveRef<SchemaObject>(schema.$ref); 561 + const refSchema = context.resolveRef<OpenAPIV2.SchemaObject>(schema.$ref); 561 562 const originalRef = state.$ref; 562 563 state.$ref = schema.$ref; 563 564 schemaToIrSchema({ ··· 579 580 }: { 580 581 context: Context; 581 582 irSchema?: IR.SchemaObject; 582 - schema: SchemaWithRequired<SchemaObject, 'type'>; 583 + schema: SchemaWithRequired<OpenAPIV2.SchemaObject, 'type'>; 583 584 state: SchemaState; 584 585 }): IR.SchemaObject => { 585 586 if (!irSchema) { ··· 622 623 state, 623 624 }: { 624 625 context: Context; 625 - schema: SchemaWithRequired<SchemaObject, 'type'>; 626 + schema: SchemaWithRequired<OpenAPIV2.SchemaObject, 'type'>; 626 627 state: SchemaState; 627 628 }): IR.SchemaObject => { 628 629 const irSchema = initIrSchema({ schema }); ··· 666 667 }: { 667 668 context: Context; 668 669 irSchema?: IR.SchemaObject; 669 - schema: SchemaWithRequired<SchemaObject, 'type'>; 670 + schema: SchemaWithRequired<OpenAPIV2.SchemaObject, 'type'>; 670 671 state: SchemaState; 671 672 }): IR.SchemaObject => { 672 673 if (!irSchema) { ··· 728 729 }: { 729 730 context: Context; 730 731 irSchema?: IR.SchemaObject; 731 - schema: SchemaObject; 732 + schema: OpenAPIV2.SchemaObject; 732 733 }): IR.SchemaObject => { 733 734 if (!irSchema) { 734 735 irSchema = initIrSchema({ schema }); ··· 747 748 state, 748 749 }: { 749 750 context: Context; 750 - schema: SchemaObject; 751 + schema: OpenAPIV2.SchemaObject; 751 752 state: SchemaState | undefined; 752 753 }): IR.SchemaObject => { 753 754 if (!state) { ··· 763 764 if (schema.$ref) { 764 765 return parseRef({ 765 766 context, 766 - schema: schema as SchemaWithRequired<SchemaObject, '$ref'>, 767 + schema: schema as SchemaWithRequired<OpenAPIV2.SchemaObject, '$ref'>, 767 768 state, 768 769 }); 769 770 } ··· 771 772 if (schema.enum) { 772 773 return parseEnum({ 773 774 context, 774 - schema: schema as SchemaWithRequired<SchemaObject, 'enum'>, 775 + schema: schema as SchemaWithRequired<OpenAPIV2.SchemaObject, 'enum'>, 775 776 state, 776 777 }); 777 778 } ··· 779 780 if (schema.allOf) { 780 781 return parseAllOf({ 781 782 context, 782 - schema: schema as SchemaWithRequired<SchemaObject, 'allOf'>, 783 + schema: schema as SchemaWithRequired<OpenAPIV2.SchemaObject, 'allOf'>, 783 784 state, 784 785 }); 785 786 } ··· 788 789 if (schema.type || schema.properties) { 789 790 return parseType({ 790 791 context, 791 - schema: schema as SchemaWithRequired<SchemaObject, 'type'>, 792 + schema: schema as SchemaWithRequired<OpenAPIV2.SchemaObject, 'type'>, 792 793 state, 793 794 }); 794 795 } ··· 803 804 }: { 804 805 $ref: string; 805 806 context: Context; 806 - schema: SchemaObject; 807 + schema: OpenAPIV2.SchemaObject; 807 808 }) => { 808 809 if (!context.ir.components) { 809 810 context.ir.components = {};
+4 -4
packages/shared/src/openApi/2.0.x/parser/validate.ts
··· 1 1 import type { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV2 } from '@hey-api/spec-types'; 2 3 3 4 import { createOperationKey } from '../../../ir/operation'; 4 5 import { httpMethods } from '../../../openApi/shared/utils/operation'; 5 6 import type { ValidatorIssue, ValidatorResult } from '../../../openApi/shared/utils/validator'; 6 - import type { OpenApiV2_0_X, PathItemObject, PathsObject } from '../types/spec'; 7 7 8 - export const validateOpenApiSpec = (spec: OpenApiV2_0_X, logger: Logger): ValidatorResult => { 8 + export const validateOpenApiSpec = (spec: OpenAPIV2.Document, logger: Logger): ValidatorResult => { 9 9 const eventValidate = logger.timeEvent('validate'); 10 10 const issues: Array<ValidatorIssue> = []; 11 11 const operationIds = new Map(); 12 12 13 13 if (spec.paths) { 14 14 for (const entry of Object.entries(spec.paths)) { 15 - const path = entry[0] as keyof PathsObject; 16 - const pathItem = entry[1] as PathItemObject; 15 + const path = entry[0] as keyof OpenAPIV2.PathsObject; 16 + const pathItem = entry[1] as OpenAPIV2.PathItemObject; 17 17 for (const method of httpMethods) { 18 18 if (method === 'trace') { 19 19 continue;
+11 -4
packages/shared/src/openApi/2.0.x/types/json-schema-draft-4.ts packages/spec-types/src/json-schema/draft-4/spec.ts
··· 1 1 import type { AnyString } from '@hey-api/types'; 2 2 3 - import type { EnumExtensions } from '../../../openApi/shared/types'; 3 + import type { EnumExtensions } from '../../extensions/openapi'; 4 4 5 - export interface JsonSchemaDraft4 extends EnumExtensions { 5 + export interface Document extends EnumExtensions { 6 6 /** 7 7 * A schema can reference another schema using the `$ref` keyword. The value of `$ref` is a URI-reference that is resolved against the schema's {@link https://json-schema.org/understanding-json-schema/structuring#base-uri Base URI}. When evaluating a `$ref`, an implementation uses the resolved identifier to retrieve the referenced schema and applies that schema to the {@link https://json-schema.org/learn/glossary#instance instance}. 8 8 * ··· 143 143 uniqueItems?: boolean; 144 144 } 145 145 146 - type JsonSchemaFormats = 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uri' | AnyString; 146 + export type JsonSchemaFormats = 147 + | 'date-time' 148 + | 'email' 149 + | 'hostname' 150 + | 'ipv4' 151 + | 'ipv6' 152 + | 'uri' 153 + | AnyString; 147 154 148 - type JsonSchemaTypes = 'array' | 'boolean' | 'integer' | 'number' | 'object' | 'string'; 155 + export type JsonSchemaTypes = 'array' | 'boolean' | 'integer' | 'number' | 'object' | 'string';
+1 -1
packages/shared/src/openApi/2.0.x/types/openapi-spec-extensions.ts packages/spec-types/src/openapi/v2/extensions.ts
··· 1 - export interface OpenApiV2_0_X_Nullable_Extensions { 1 + export interface OpenAPIV2NullableExtensions { 2 2 /** 3 3 * OpenAPI 2.0 does not natively support null as a type, but you can use 4 4 * `x-nullable` to polyfill this functionality.
+8 -8
packages/shared/src/openApi/2.0.x/types/spec.ts packages/spec-types/src/openapi/v2/spec.ts
··· 1 - import type { CodeSampleObject, EnumExtensions } from '../../../openApi/shared/types'; 2 - import type { JsonSchemaDraft4 } from './json-schema-draft-4'; 3 - import type { OpenApiV2_0_X_Nullable_Extensions } from './openapi-spec-extensions'; 1 + import type { CodeSampleObject, EnumExtensions } from '../../extensions/openapi'; 2 + import type { Document as JSONSchemaDraft4 } from '../../json-schema/draft-4/spec'; 3 + import type { OpenAPIV2NullableExtensions } from './extensions'; 4 4 5 5 /** 6 6 * This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. 7 7 */ 8 - export interface OpenApiV2_0_X { 8 + export interface Document { 9 9 /** 10 10 * Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#specification-extensions Vendor Extensions} for further details. 11 11 */ ··· 192 192 * type: integer 193 193 * ``` 194 194 */ 195 - export interface HeaderObject extends EnumExtensions, OpenApiV2_0_X_Nullable_Extensions { 195 + export interface HeaderObject extends EnumExtensions, OpenAPIV2NullableExtensions { 196 196 /** 197 197 * Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#specification-extensions Vendor Extensions} for further details. 198 198 */ ··· 378 378 * maximum: 63 379 379 * ``` 380 380 */ 381 - export interface ItemsObject extends EnumExtensions, OpenApiV2_0_X_Nullable_Extensions { 381 + export interface ItemsObject extends EnumExtensions, OpenAPIV2NullableExtensions { 382 382 /** 383 383 * Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#specification-extensions Vendor Extensions} for further details. 384 384 */ ··· 684 684 * ``` 685 685 */ 686 686 export type ParameterObject = EnumExtensions & 687 - OpenApiV2_0_X_Nullable_Extensions & { 687 + OpenAPIV2NullableExtensions & { 688 688 /** 689 689 * Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#specification-extensions Vendor Extensions} for further details. 690 690 */ ··· 1306 1306 * - packSize 1307 1307 * ``` 1308 1308 */ 1309 - export interface SchemaObject extends JsonSchemaDraft4, OpenApiV2_0_X_Nullable_Extensions { 1309 + export interface SchemaObject extends JSONSchemaDraft4, OpenAPIV2NullableExtensions { 1310 1310 /** 1311 1311 * Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#specification-extensions Vendor Extensions} for further details. 1312 1312 */
-21
packages/shared/src/openApi/3.0.x/index.ts
··· 1 1 export { parseV3_0_X } from './parser'; 2 - export type { OpenApiV3_0_X } from './types/spec'; 3 - 4 - import type { 5 - InfoObject, 6 - OperationObject, 7 - ParameterObject, 8 - ReferenceObject, 9 - RequestBodyObject, 10 - ResponseObject, 11 - SchemaObject, 12 - } from './types/spec'; 13 - 14 - export interface OpenApiV3_0_XTypes { 15 - InfoObject: InfoObject; 16 - OperationObject: OperationObject; 17 - ParameterObject: ParameterObject; 18 - ReferenceObject: ReferenceObject; 19 - RequestBodyObject: RequestBodyObject; 20 - ResponseObject: ResponseObject; 21 - SchemaObject: SchemaObject; 22 - }
+4 -3
packages/shared/src/openApi/3.0.x/parser/__tests__/operation.test.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../../ir/context'; 2 - import type { SecuritySchemeObject } from '../../types/spec'; 3 4 import { parsePathOperation } from '../operation'; 4 5 5 6 type ParseOperationProps = Parameters<typeof parsePathOperation>[0]; ··· 38 39 }; 39 40 const path = '/test'; 40 41 41 - const oauth2: SecuritySchemeObject = { 42 + const oauth2: OpenAPIV3.SecuritySchemeObject = { 42 43 description: 'OAuth2', 43 44 flows: { 44 45 password: { ··· 51 52 }, 52 53 type: 'oauth2', 53 54 }; 54 - const securitySchemesMap = new Map<string, SecuritySchemeObject>([ 55 + const securitySchemesMap = new Map<string, OpenAPIV3.SecuritySchemeObject>([ 55 56 ['apiKeyAuth', { in: 'header', name: 'Auth', type: 'apiKey' }], 56 57 ['basicAuthRule', { description: 'Basic Auth', scheme: 'basic', type: 'http' }], 57 58 ['oauthRule', oauth2],
+4 -4
packages/shared/src/openApi/3.0.x/parser/filter.ts
··· 1 1 import type { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 3 3 4 import { createOperationKey } from '../../../ir/operation'; 4 5 import { addNamespace, removeNamespace } from '../../../openApi/shared/utils/filter'; 5 6 import { httpMethods } from '../../../openApi/shared/utils/operation'; 6 - import type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec'; 7 7 8 8 /** 9 9 * Replace source spec with filtered version. ··· 25 25 requestBodies: Set<string>; 26 26 responses: Set<string>; 27 27 schemas: Set<string>; 28 - spec: OpenApiV3_0_X; 28 + spec: OpenAPIV3.Document; 29 29 }) => { 30 30 const eventFilterSpec = logger.timeEvent('filter-spec'); 31 31 if (spec.components) { ··· 120 120 121 121 if (spec.paths) { 122 122 for (const entry of Object.entries(spec.paths)) { 123 - const path = entry[0] as keyof PathsObject; 124 - const pathItem = entry[1] as PathItemObject; 123 + const path = entry[0] as keyof OpenAPIV3.PathsObject; 124 + const pathItem = entry[1] as OpenAPIV3.PathItemObject; 125 125 126 126 for (const method of httpMethods) { 127 127 const operation = pathItem[method];
+11 -15
packages/shared/src/openApi/3.0.x/parser/index.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { buildResourceMetadata } from '../../../openApi/shared/graph/meta'; 3 5 import { transformOpenApiSpec } from '../../../openApi/shared/transforms'; ··· 10 12 import { buildGraph } from '../../../openApi/shared/utils/graph'; 11 13 import { mergeParametersObjects } from '../../../openApi/shared/utils/parameter'; 12 14 import { handleValidatorResult } from '../../../openApi/shared/utils/validator'; 13 - import type { 14 - OpenApiV3_0_X, 15 - ParameterObject, 16 - PathItemObject, 17 - PathsObject, 18 - RequestBodyObject, 19 - SecuritySchemeObject, 20 - } from '../types/spec'; 21 15 import { filterSpec } from './filter'; 22 16 import { parsePathOperation } from './operation'; 23 17 import { parametersArrayToObject, parseParameter } from './parameter'; ··· 26 20 import { parseServers } from './server'; 27 21 import { validateOpenApiSpec } from './validate'; 28 22 29 - export const parseV3_0_X = (context: Context<OpenApiV3_0_X>) => { 23 + export const parseV3_0_X = (context: Context<OpenAPIV3.Document>) => { 30 24 if (context.config.parser.validate_EXPERIMENTAL) { 31 25 const result = validateOpenApiSpec(context.spec, context.logger); 32 26 handleValidatorResult({ context, result }); ··· 55 49 const state: State = { 56 50 ids: new Map(), 57 51 }; 58 - const securitySchemesMap = new Map<string, SecuritySchemeObject>(); 52 + const securitySchemesMap = new Map<string, OpenAPIV3.SecuritySchemeObject>(); 59 53 60 54 // TODO: parser - handle more component types, old parser handles only parameters and schemas 61 55 if (context.spec.components) { ··· 63 57 const securityOrReference = context.spec.components.securitySchemes[name]!; 64 58 const securitySchemeObject = 65 59 '$ref' in securityOrReference 66 - ? context.resolveRef<SecuritySchemeObject>(securityOrReference.$ref) 60 + ? context.resolveRef<OpenAPIV3.SecuritySchemeObject>(securityOrReference.$ref) 67 61 : securityOrReference; 68 62 securitySchemesMap.set(name, securitySchemeObject); 69 63 } ··· 73 67 const parameterOrReference = context.spec.components.parameters[name]!; 74 68 const parameter = 75 69 '$ref' in parameterOrReference 76 - ? context.resolveRef<ParameterObject>(parameterOrReference.$ref) 70 + ? context.resolveRef<OpenAPIV3.ParameterObject>(parameterOrReference.$ref) 77 71 : parameterOrReference; 78 72 79 73 parseParameter({ ··· 88 82 const requestBodyOrReference = context.spec.components.requestBodies[name]!; 89 83 const requestBody = 90 84 '$ref' in requestBodyOrReference 91 - ? context.resolveRef<RequestBodyObject>(requestBodyOrReference.$ref) 85 + ? context.resolveRef<OpenAPIV3.RequestBodyObject>(requestBodyOrReference.$ref) 92 86 : requestBodyOrReference; 93 87 94 88 parseRequestBody({ ··· 114 108 115 109 for (const path in context.spec.paths) { 116 110 if (path.startsWith('x-')) continue; 117 - const pathItem = context.spec.paths[path as keyof PathsObject]! as PathItemObject; 111 + const pathItem = context.spec.paths[ 112 + path as keyof OpenAPIV3.PathsObject 113 + ]! as OpenAPIV3.PathItemObject; 118 114 119 115 const finalPathItem = pathItem.$ref 120 116 ? { 121 - ...context.resolveRef<PathItemObject>(pathItem.$ref), 117 + ...context.resolveRef<OpenAPIV3.PathItemObject>(pathItem.$ref), 122 118 ...pathItem, 123 119 } 124 120 : pathItem;
+9 -4
packages/shared/src/openApi/3.0.x/parser/mediaType.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { IRMediaType } from '../../../ir/mediaType'; 2 4 import { isMediaTypeFileLike, mediaTypeToIrMediaType } from '../../../ir/mediaType'; 3 - import type { MediaTypeObject, ReferenceObject, SchemaObject } from '../types/spec'; 4 5 5 6 interface Content { 6 7 mediaType: string; 7 - schema: SchemaObject | ReferenceObject | undefined; 8 + schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | undefined; 8 9 type: IRMediaType | undefined; 9 10 } 10 11 11 - export const contentToSchema = ({ content }: { content: Content }): SchemaObject | undefined => { 12 + export const contentToSchema = ({ 13 + content, 14 + }: { 15 + content: Content; 16 + }): OpenAPIV3.SchemaObject | undefined => { 12 17 const { mediaType, schema } = content; 13 18 14 19 if (schema && '$ref' in schema) { ··· 40 45 export const mediaTypeObjects = ({ 41 46 content, 42 47 }: { 43 - content: Record<string, MediaTypeObject> | undefined; 48 + content: Record<string, OpenAPIV3.MediaTypeObject> | undefined; 44 49 }): ReadonlyArray<Content> => { 45 50 const objects: Array<Content> = []; 46 51
+11 -15
packages/shared/src/openApi/3.0.x/parser/operation.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import type { State } from '../../../openApi/shared/types/state'; 4 6 import { operationToId } from '../../../openApi/shared/utils/operation'; 5 - import type { 6 - OperationObject, 7 - PathItemObject, 8 - ReferenceObject, 9 - RequestBodyObject, 10 - ResponseObject, 11 - SecuritySchemeObject, 12 - } from '../types/spec'; 13 7 import { contentToSchema, mediaTypeObjects } from './mediaType'; 14 8 import { paginationField } from './pagination'; 15 9 import { parseExtensions, schemaToIrSchema } from './schema'; 16 10 17 11 interface Operation 18 - extends Omit<OperationObject, 'parameters'>, Pick<IR.OperationObject, 'parameters'> {} 12 + extends Omit<OpenAPIV3.OperationObject, 'parameters'>, Pick<IR.OperationObject, 'parameters'> {} 19 13 20 14 const parseOperationJsDoc = ({ 21 15 irOperation, ··· 91 85 }: Pick<IR.OperationObject, 'method' | 'path'> & { 92 86 context: Context; 93 87 operation: Operation; 94 - securitySchemesMap: Map<string, SecuritySchemeObject>; 88 + securitySchemesMap: Map<string, OpenAPIV3.SecuritySchemeObject>; 95 89 state: State; 96 90 }): IR.OperationObject => { 97 91 const irOperation = initIrOperation({ ··· 109 103 if (operation.requestBody) { 110 104 const requestBody = 111 105 '$ref' in operation.requestBody 112 - ? context.resolveRef<RequestBodyObject>(operation.requestBody.$ref) 106 + ? context.resolveRef<OpenAPIV3.RequestBodyObject>(operation.requestBody.$ref) 113 107 : operation.requestBody; 114 108 const contents = mediaTypeObjects({ content: requestBody.content }); 115 109 // TODO: add support for multiple content types, for now prefer JSON ··· 175 169 irOperation.responses = {}; 176 170 } 177 171 178 - const response = operation.responses[name]! as ResponseObject | ReferenceObject; 172 + const response = operation.responses[name]! as 173 + | OpenAPIV3.ResponseObject 174 + | OpenAPIV3.ReferenceObject; 179 175 const responseObject = 180 - '$ref' in response ? context.resolveRef<ResponseObject>(response.$ref) : response; 176 + '$ref' in response ? context.resolveRef<OpenAPIV3.ResponseObject>(response.$ref) : response; 181 177 const contents = mediaTypeObjects({ content: responseObject.content }); 182 178 // TODO: add support for multiple content types, for now prefer JSON 183 179 const content = contents.find((content) => content.type === 'json') || contents[0]; ··· 242 238 }: { 243 239 context: Context; 244 240 method: Extract< 245 - keyof PathItemObject, 241 + keyof OpenAPIV3.PathItemObject, 246 242 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace' 247 243 >; 248 244 operation: Operation; 249 245 path: keyof IR.PathsObject; 250 - securitySchemesMap: Map<string, SecuritySchemeObject>; 246 + securitySchemesMap: Map<string, OpenAPIV3.SecuritySchemeObject>; 251 247 state: State; 252 248 }) => { 253 249 if (!context.ir.paths) {
+8 -6
packages/shared/src/openApi/3.0.x/parser/pagination.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { getPaginationKeywordsRegExp } from '../../../ir/pagination'; 3 5 import type { SchemaType } from '../../../openApi/shared/types/schema'; 4 - import type { ParameterObject, ReferenceObject, RequestBodyObject } from '../types/spec'; 5 - import type { SchemaObject } from '../types/spec'; 6 6 import { mediaTypeObjects } from './mediaType'; 7 7 import { getSchemaType } from './schema'; 8 8 9 - const isPaginationType = (schemaType: SchemaType<SchemaObject> | undefined): boolean => 9 + const isPaginationType = (schemaType: SchemaType<OpenAPIV3.SchemaObject> | undefined): boolean => 10 10 schemaType === 'boolean' || 11 11 schemaType === 'integer' || 12 12 schemaType === 'number' || ··· 20 20 }: { 21 21 context: Context; 22 22 name: string; 23 - schema: SchemaObject | ReferenceObject; 23 + schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; 24 24 }): boolean | string => { 25 25 const paginationRegExp = getPaginationKeywordsRegExp(context.config.parser.pagination); 26 26 if (paginationRegExp.test(name)) { ··· 28 28 } 29 29 30 30 if ('$ref' in schema) { 31 - const ref = context.resolveRef<ParameterObject | RequestBodyObject | SchemaObject>(schema.$ref); 31 + const ref = context.resolveRef< 32 + OpenAPIV3.ParameterObject | OpenAPIV3.RequestBodyObject | OpenAPIV3.SchemaObject 33 + >(schema.$ref); 32 34 33 35 if ('content' in ref || 'in' in ref) { 34 - let refSchema: SchemaObject | ReferenceObject | undefined; 36 + let refSchema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | undefined; 35 37 36 38 if ('in' in ref) { 37 39 refSchema = ref.schema;
+12 -9
packages/shared/src/openApi/3.0.x/parser/parameter.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import { refToName } from '../../../utils/ref'; 4 - import type { ParameterObject, ReferenceObject, SchemaObject } from '../types/spec'; 5 6 import { mediaTypeObjects } from './mediaType'; 6 7 import { paginationField } from './pagination'; 7 8 import { parseExtensions, schemaToIrSchema } from './schema'; ··· 9 10 /** 10 11 * Returns default parameter `allowReserved` based on value of `in`. 11 12 */ 12 - const defaultAllowReserved = (_in: ParameterObject['in']): boolean | undefined => { 13 + const defaultAllowReserved = (_in: OpenAPIV3.ParameterObject['in']): boolean | undefined => { 13 14 switch (_in) { 14 15 // this keyword only applies to parameters with an `in` value of `query` 15 16 case 'query': ··· 22 23 /** 23 24 * Returns default parameter `explode` based on value of `style`. 24 25 */ 25 - const defaultExplode = (style: Required<ParameterObject>['style']): boolean => { 26 + const defaultExplode = (style: Required<OpenAPIV3.ParameterObject>['style']): boolean => { 26 27 switch (style) { 27 28 // default value for `deepObject` is `false`, but that behavior is undefined 28 29 // so we use `true` to make this work with the `client-fetch` package ··· 37 38 /** 38 39 * Returns default parameter `style` based on value of `in`. 39 40 */ 40 - const defaultStyle = (_in: ParameterObject['in']): Required<IR.ParameterObject>['style'] => { 41 + const defaultStyle = ( 42 + _in: OpenAPIV3.ParameterObject['in'], 43 + ): Required<IR.ParameterObject>['style'] => { 41 44 switch (_in) { 42 45 case 'header': 43 46 case 'path': ··· 53 56 parameters, 54 57 }: { 55 58 context: Context; 56 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 59 + parameters?: ReadonlyArray<OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject>; 57 60 }): IR.ParametersObject | undefined => { 58 61 if (!parameters || !Object.keys(parameters).length) { 59 62 return; ··· 64 67 for (const parameterOrReference of parameters) { 65 68 const parameter = 66 69 '$ref' in parameterOrReference 67 - ? context.dereference<ParameterObject>(parameterOrReference) 70 + ? context.dereference<OpenAPIV3.ParameterObject>(parameterOrReference) 68 71 : parameterOrReference; 69 72 70 73 if (!parametersObject[parameter.in]) { ··· 89 92 }: { 90 93 $ref: string; 91 94 context: Context; 92 - parameter: ParameterObject; 95 + parameter: OpenAPIV3.ParameterObject; 93 96 }): IR.ParameterObject => { 94 97 // TODO: parser - fix 95 98 let schema = parameter.schema; ··· 103 106 } 104 107 } 105 108 106 - const finalSchema: SchemaObject = 109 + const finalSchema: OpenAPIV3.SchemaObject = 107 110 schema && '$ref' in schema 108 111 ? { 109 112 allOf: [{ ...schema }], ··· 176 179 }: { 177 180 $ref: string; 178 181 context: Context; 179 - parameter: ParameterObject; 182 + parameter: OpenAPIV3.ParameterObject; 180 183 }) => { 181 184 if (!context.ir.components) { 182 185 context.ir.components = {};
+5 -4
packages/shared/src/openApi/3.0.x/parser/requestBody.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import { refToName } from '../../../utils/ref'; 4 - import type { RequestBodyObject, SchemaObject } from '../types/spec'; 5 6 import { mediaTypeObjects } from './mediaType'; 6 7 import { schemaToIrSchema } from './schema'; 7 8 ··· 12 13 }: { 13 14 $ref: string; 14 15 context: Context; 15 - requestBody: RequestBodyObject; 16 + requestBody: OpenAPIV3.RequestBodyObject; 16 17 }): IR.RequestBodyObject => { 17 18 // TODO: parser - fix 18 19 const contents = mediaTypeObjects({ content: requestBody.content }); ··· 20 21 const content = contents.find((content) => content.type === 'json') || contents[0]; 21 22 const schema = content ? content.schema : undefined; 22 23 23 - const finalSchema: SchemaObject = { 24 + const finalSchema: OpenAPIV3.SchemaObject = { 24 25 description: requestBody.description, 25 26 ...schema, 26 27 }; ··· 54 55 }: { 55 56 $ref: string; 56 57 context: Context; 57 - requestBody: RequestBodyObject; 58 + requestBody: OpenAPIV3.RequestBodyObject; 58 59 }) => { 59 60 if (!context.ir.components) { 60 61 context.ir.components = {};
+49 -47
packages/shared/src/openApi/3.0.x/parser/schema.ts
··· 1 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import { addItemsToSchema } from '../../../ir/utils'; ··· 12 14 discriminatorValues, 13 15 } from '../../../openApi/shared/utils/discriminator'; 14 16 import { isTopLevelComponent, refToName } from '../../../utils/ref'; 15 - import type { ReferenceObject, SchemaObject } from '../types/spec'; 16 17 17 18 export const getSchemaType = ({ 18 19 schema, 19 20 }: { 20 - schema: SchemaObject; 21 - }): SchemaType<SchemaObject> | undefined => { 21 + schema: OpenAPIV3.SchemaObject; 22 + }): SchemaType<OpenAPIV3.SchemaObject> | undefined => { 22 23 if (schema.type) { 23 24 return schema.type; 24 25 } ··· 42 43 }: { 43 44 context: Context; 44 45 propertyName: string; 45 - schemas: ReadonlyArray<SchemaObject | ReferenceObject>; 46 + schemas: ReadonlyArray<OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject>; 46 47 }): DiscriminatorPropertyType => { 47 48 for (const schema of schemas) { 48 - const resolved = '$ref' in schema ? context.resolveRef<SchemaObject>(schema.$ref) : schema; 49 + const resolved = 50 + '$ref' in schema ? context.resolveRef<OpenAPIV3.SchemaObject>(schema.$ref) : schema; 49 51 50 52 // Check direct properties 51 53 const property = resolved.properties?.[propertyName]; 52 54 if (property) { 53 55 const resolvedProperty = 54 - '$ref' in property ? context.resolveRef<SchemaObject>(property.$ref) : property; 56 + '$ref' in property ? context.resolveRef<OpenAPIV3.SchemaObject>(property.$ref) : property; 55 57 if ( 56 58 resolvedProperty.type === 'boolean' || 57 59 resolvedProperty.type === 'integer' || ··· 89 91 }: { 90 92 context: Context; 91 93 discriminators?: Array<{ 92 - discriminator: NonNullable<SchemaObject['discriminator']>; 93 - oneOf?: SchemaObject['oneOf']; 94 + discriminator: NonNullable<OpenAPIV3.SchemaObject['discriminator']>; 95 + oneOf?: OpenAPIV3.SchemaObject['oneOf']; 94 96 }>; 95 - schema: SchemaObject; 97 + schema: OpenAPIV3.SchemaObject; 96 98 }): Array<{ 97 - discriminator: NonNullable<SchemaObject['discriminator']>; 98 - oneOf?: SchemaObject['oneOf']; 99 + discriminator: NonNullable<OpenAPIV3.SchemaObject['discriminator']>; 100 + oneOf?: OpenAPIV3.SchemaObject['oneOf']; 99 101 }> => { 100 102 // Check if this schema has a discriminator 101 103 if (schema.discriminator) { ··· 108 110 // If this schema is an allOf composition, recursively search in its components 109 111 if (schema.allOf) { 110 112 for (const compositionSchema of schema.allOf) { 111 - let resolvedSchema: SchemaObject; 113 + let resolvedSchema: OpenAPIV3.SchemaObject; 112 114 if ('$ref' in compositionSchema) { 113 - resolvedSchema = context.resolveRef<SchemaObject>(compositionSchema.$ref); 115 + resolvedSchema = context.resolveRef<OpenAPIV3.SchemaObject>(compositionSchema.$ref); 114 116 } else { 115 117 resolvedSchema = compositionSchema; 116 118 } ··· 134 136 discriminator, 135 137 schemaRef, 136 138 }: { 137 - discriminator: NonNullable<SchemaObject['discriminator']>; 139 + discriminator: NonNullable<OpenAPIV3.SchemaObject['discriminator']>; 138 140 schemaRef: string; 139 141 }): Array<string> => { 140 142 const values: Array<string> = []; ··· 155 157 schema, 156 158 }: { 157 159 irSchema: IR.SchemaObject; 158 - schema: SchemaObject; 160 + schema: OpenAPIV3.SchemaObject; 159 161 }) => { 160 162 if (schema.deprecated !== undefined) { 161 163 irSchema.deprecated = schema.deprecated; ··· 179 181 schema, 180 182 }: { 181 183 irSchema: IR.SchemaObject; 182 - schema: SchemaObject; 184 + schema: OpenAPIV3.SchemaObject; 183 185 }) => { 184 186 if (schema.default !== undefined) { 185 187 irSchema.default = schema.default; ··· 240 242 }: { 241 243 context: Context; 242 244 irSchema?: IR.SchemaObject; 243 - schema: SchemaObject; 245 + schema: OpenAPIV3.SchemaObject; 244 246 state: SchemaState; 245 247 }): IR.SchemaObject => { 246 248 if (schema.maxItems && schema.maxItems === schema.minItems) { ··· 291 293 }: { 292 294 context: Context; 293 295 irSchema?: IR.SchemaObject; 294 - schema: SchemaObject; 296 + schema: OpenAPIV3.SchemaObject; 295 297 state: SchemaState; 296 298 }): IR.SchemaObject => { 297 299 irSchema.type = 'boolean'; ··· 305 307 }: { 306 308 context: Context; 307 309 irSchema?: IR.SchemaObject; 308 - schema: SchemaWithRequired<SchemaObject, 'type'>; 310 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'type'>; 309 311 state: SchemaState; 310 312 }): IR.SchemaObject => { 311 313 irSchema.type = schema.type; ··· 321 323 }: { 322 324 context: Context; 323 325 irSchema?: IR.SchemaObject; 324 - schema: SchemaObject; 326 + schema: OpenAPIV3.SchemaObject; 325 327 state: SchemaState; 326 328 }): IR.SchemaObject => { 327 329 irSchema.type = 'object'; ··· 415 417 }: { 416 418 context: Context; 417 419 irSchema?: IR.SchemaObject; 418 - schema: SchemaObject; 420 + schema: OpenAPIV3.SchemaObject; 419 421 state: SchemaState; 420 422 }): IR.SchemaObject => { 421 423 irSchema.type = 'string'; ··· 431 433 } 432 434 }; 433 435 434 - const initIrSchema = ({ schema }: { schema: SchemaObject }): IR.SchemaObject => { 436 + const initIrSchema = ({ schema }: { schema: OpenAPIV3.SchemaObject }): IR.SchemaObject => { 435 437 const irSchema: IR.SchemaObject = {}; 436 438 437 439 parseSchemaJsDoc({ ··· 453 455 state, 454 456 }: { 455 457 context: Context; 456 - schema: SchemaWithRequired<SchemaObject, 'allOf'>; 458 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'allOf'>; 457 459 state: SchemaState; 458 460 }): IR.SchemaObject => { 459 461 let irSchema = initIrSchema({ schema }); ··· 465 467 466 468 // Collect discriminator information to add after all compositions are processed 467 469 type DiscriminatorInfo = { 468 - discriminator: NonNullable<SchemaObject['discriminator']>; 470 + discriminator: NonNullable<OpenAPIV3.SchemaObject['discriminator']>; 469 471 isExplicitMapping: boolean; 470 472 isRequired: boolean; 471 473 values: ReadonlyArray<string>; ··· 499 501 schemaItems.push(irCompositionSchema); 500 502 501 503 if ('$ref' in compositionSchema) { 502 - const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref); 504 + const ref = context.resolveRef<OpenAPIV3.SchemaObject>(compositionSchema.$ref); 503 505 // `$ref` should be passed from the root `parseSchema()` call 504 506 if (state.$ref) { 505 507 // Find all discriminators in the referenced schema, including nested allOf compositions ··· 549 551 (ref.allOf && 550 552 ref.allOf.some((item) => { 551 553 const resolvedItem = 552 - '$ref' in item ? context.resolveRef<SchemaObject>(item.$ref) : item; 554 + '$ref' in item ? context.resolveRef<OpenAPIV3.SchemaObject>(item.$ref) : item; 553 555 return resolvedItem.required?.includes(d.discriminator.propertyName); 554 556 }))), 555 557 ); ··· 603 605 const hasProperty = (() => { 604 606 if (!item.$ref) return false; 605 607 try { 606 - const refSchema = context.resolveRef<SchemaObject>(item.$ref); 608 + const refSchema = context.resolveRef<OpenAPIV3.SchemaObject>(item.$ref); 607 609 // Check if the discriminator property exists in the ref schema 608 610 return ( 609 611 refSchema.properties?.[discriminator.propertyName] !== undefined || ··· 611 613 refSchema.allOf.some((allOfItem) => { 612 614 const resolved = 613 615 '$ref' in allOfItem 614 - ? context.resolveRef<SchemaObject>(allOfItem.$ref) 616 + ? context.resolveRef<OpenAPIV3.SchemaObject>(allOfItem.$ref) 615 617 : allOfItem; 616 618 return resolved.properties?.[discriminator.propertyName] !== undefined; 617 619 })) ··· 692 694 // TODO: parser - this could be probably resolved more accurately 693 695 const finalCompositionSchema = 694 696 '$ref' in compositionSchema 695 - ? context.resolveRef<SchemaObject>(compositionSchema.$ref) 697 + ? context.resolveRef<OpenAPIV3.SchemaObject>(compositionSchema.$ref) 696 698 : compositionSchema; 697 699 698 700 if (getSchemaType({ schema: finalCompositionSchema }) === 'object') { ··· 764 766 state, 765 767 }: { 766 768 context: Context; 767 - schema: SchemaWithRequired<SchemaObject, 'anyOf'>; 769 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'anyOf'>; 768 770 state: SchemaState; 769 771 }): IR.SchemaObject => { 770 772 let irSchema = initIrSchema({ schema }); ··· 855 857 state, 856 858 }: { 857 859 context: Context; 858 - schema: SchemaWithRequired<SchemaObject, 'enum'>; 860 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'enum'>; 859 861 state: SchemaState; 860 862 }): IR.SchemaObject => { 861 863 let irSchema = initIrSchema({ schema }); ··· 866 868 867 869 for (const [index, enumValue] of schema.enum.entries()) { 868 870 const typeOfEnumValue = typeof enumValue; 869 - let enumType: SchemaType<SchemaObject> | 'null' | undefined; 871 + let enumType: SchemaType<OpenAPIV3.SchemaObject> | 'null' | undefined; 870 872 871 873 if ( 872 874 typeOfEnumValue === 'string' || ··· 932 934 state, 933 935 }: { 934 936 context: Context; 935 - schema: SchemaWithRequired<SchemaObject, 'oneOf'>; 937 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'oneOf'>; 936 938 state: SchemaState; 937 939 }): IR.SchemaObject => { 938 940 let irSchema = initIrSchema({ schema }); ··· 1035 1037 state, 1036 1038 }: { 1037 1039 context: Context; 1038 - schema: ReferenceObject; 1040 + schema: OpenAPIV3.ReferenceObject; 1039 1041 state: SchemaState; 1040 1042 }): IR.SchemaObject => { 1041 1043 // Inline non-component refs (e.g. #/paths/...) and deep path refs (e.g. #/components/schemas/Foo/properties/bar) ··· 1043 1045 const isComponentsRef = isTopLevelComponent(schema.$ref); 1044 1046 if (!isComponentsRef) { 1045 1047 if (!state.circularReferenceTracker.has(schema.$ref)) { 1046 - const refSchema = context.resolveRef<SchemaObject>(schema.$ref); 1048 + const refSchema = context.resolveRef<OpenAPIV3.SchemaObject>(schema.$ref); 1047 1049 const originalRef = state.$ref; 1048 1050 state.$ref = schema.$ref; 1049 1051 const irSchema = schemaToIrSchema({ ··· 1064 1066 irSchema.$ref = decodeURI(schema.$ref); 1065 1067 1066 1068 if (!state.circularReferenceTracker.has(schema.$ref)) { 1067 - const refSchema = context.resolveRef<SchemaObject>(schema.$ref); 1069 + const refSchema = context.resolveRef<OpenAPIV3.SchemaObject>(schema.$ref); 1068 1070 const originalRef = state.$ref; 1069 1071 state.$ref = schema.$ref; 1070 1072 schemaToIrSchema({ ··· 1086 1088 }: { 1087 1089 context: Context; 1088 1090 irSchema?: IR.SchemaObject; 1089 - schema: SchemaWithRequired<SchemaObject, 'type'>; 1091 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'type'>; 1090 1092 state: SchemaState; 1091 1093 }): IR.SchemaObject => { 1092 1094 if (!irSchema) { ··· 1129 1131 state, 1130 1132 }: { 1131 1133 context: Context; 1132 - schema: SchemaWithRequired<SchemaObject, 'type'>; 1134 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'type'>; 1133 1135 state: SchemaState; 1134 1136 }): IR.SchemaObject => { 1135 1137 const irSchema = initIrSchema({ schema }); ··· 1173 1175 }: { 1174 1176 context: Context; 1175 1177 irSchema?: IR.SchemaObject; 1176 - schema: SchemaWithRequired<SchemaObject, 'type'>; 1178 + schema: SchemaWithRequired<OpenAPIV3.SchemaObject, 'type'>; 1177 1179 state: SchemaState; 1178 1180 }): IR.SchemaObject => { 1179 1181 if (!irSchema) { ··· 1235 1237 }: { 1236 1238 context: Context; 1237 1239 irSchema?: IR.SchemaObject; 1238 - schema: SchemaObject; 1240 + schema: OpenAPIV3.SchemaObject; 1239 1241 }): IR.SchemaObject => { 1240 1242 if (!irSchema) { 1241 1243 irSchema = initIrSchema({ schema }); ··· 1254 1256 state, 1255 1257 }: { 1256 1258 context: Context; 1257 - schema: SchemaObject | ReferenceObject; 1259 + schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; 1258 1260 state: SchemaState | undefined; 1259 1261 }): IR.SchemaObject => { 1260 1262 if (!state) { ··· 1278 1280 if (schema.enum) { 1279 1281 return parseEnum({ 1280 1282 context, 1281 - schema: schema as SchemaWithRequired<SchemaObject, 'enum'>, 1283 + schema: schema as SchemaWithRequired<OpenAPIV3.SchemaObject, 'enum'>, 1282 1284 state, 1283 1285 }); 1284 1286 } ··· 1286 1288 if (schema.allOf) { 1287 1289 return parseAllOf({ 1288 1290 context, 1289 - schema: schema as SchemaWithRequired<SchemaObject, 'allOf'>, 1291 + schema: schema as SchemaWithRequired<OpenAPIV3.SchemaObject, 'allOf'>, 1290 1292 state, 1291 1293 }); 1292 1294 } ··· 1294 1296 if (schema.anyOf) { 1295 1297 return parseAnyOf({ 1296 1298 context, 1297 - schema: schema as SchemaWithRequired<SchemaObject, 'anyOf'>, 1299 + schema: schema as SchemaWithRequired<OpenAPIV3.SchemaObject, 'anyOf'>, 1298 1300 state, 1299 1301 }); 1300 1302 } ··· 1302 1304 if (schema.oneOf) { 1303 1305 return parseOneOf({ 1304 1306 context, 1305 - schema: schema as SchemaWithRequired<SchemaObject, 'oneOf'>, 1307 + schema: schema as SchemaWithRequired<OpenAPIV3.SchemaObject, 'oneOf'>, 1306 1308 state, 1307 1309 }); 1308 1310 } ··· 1311 1313 if (schema.type || schema.properties) { 1312 1314 return parseType({ 1313 1315 context, 1314 - schema: schema as SchemaWithRequired<SchemaObject, 'type'>, 1316 + schema: schema as SchemaWithRequired<OpenAPIV3.SchemaObject, 'type'>, 1315 1317 state, 1316 1318 }); 1317 1319 } ··· 1326 1328 }: { 1327 1329 $ref: string; 1328 1330 context: Context; 1329 - schema: SchemaObject | ReferenceObject; 1331 + schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; 1330 1332 }) => { 1331 1333 if (!context.ir.components) { 1332 1334 context.ir.components = {};
+4 -4
packages/shared/src/openApi/3.0.x/parser/validate.ts
··· 1 1 import type { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV3 } from '@hey-api/spec-types'; 2 3 3 4 import { createOperationKey } from '../../../ir/operation'; 4 5 import { httpMethods } from '../../../openApi/shared/utils/operation'; 5 6 import type { ValidatorIssue, ValidatorResult } from '../../../openApi/shared/utils/validator'; 6 - import type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec'; 7 7 8 - export const validateOpenApiSpec = (spec: OpenApiV3_0_X, logger: Logger): ValidatorResult => { 8 + export const validateOpenApiSpec = (spec: OpenAPIV3.Document, logger: Logger): ValidatorResult => { 9 9 const eventValidate = logger.timeEvent('validate'); 10 10 const issues: Array<ValidatorIssue> = []; 11 11 const operationIds = new Map(); 12 12 13 13 if (spec.paths) { 14 14 for (const entry of Object.entries(spec.paths)) { 15 - const path = entry[0] as keyof PathsObject; 16 - const pathItem = entry[1] as PathItemObject; 15 + const path = entry[0] as keyof OpenAPIV3.PathsObject; 16 + const pathItem = entry[1] as OpenAPIV3.PathItemObject; 17 17 for (const method of httpMethods) { 18 18 const operation = pathItem[method]; 19 19 if (!operation) {
+28 -39
packages/shared/src/openApi/3.0.x/types/spec.ts packages/spec-types/src/openapi/v3/spec.ts
··· 1 - import type { AnyString } from '@hey-api/types'; 2 - 3 - import type { CodeSampleObject, EnumExtensions } from '../../../openApi/shared/types'; 4 - 5 - /** 6 - * OpenAPI Specification Extensions. 7 - * 8 - * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 9 - */ 10 - export interface SpecificationExtensions { 11 - [extension: `x-${string}`]: unknown; 12 - } 1 + import type { CodeSampleObject, EnumExtensions, OpenAPIExtensions } from '../../extensions/openapi'; 13 2 14 3 /** 15 4 * This is the root object of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#openapi-description OpenAPI Description}. 16 5 * 17 6 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 18 7 */ 19 - export interface OpenApiV3_0_X extends SpecificationExtensions { 8 + export interface Document extends OpenAPIExtensions { 20 9 /** 21 10 * An element to hold various Objects for the OpenAPI Description. 22 11 */ ··· 58 47 * 59 48 * TODO: examples 60 49 */ 61 - export interface CallbackObject extends SpecificationExtensions { 50 + export interface CallbackObject extends OpenAPIExtensions { 62 51 /** 63 52 * A Path Item Object used to define a callback request and expected responses. A {@link https://learn.openapis.org/examples/v3.0/callback-example.html complete example} is available. 64 53 */ ··· 74 63 * 75 64 * TODO: examples 76 65 */ 77 - export interface ComponentsObject extends SpecificationExtensions { 66 + export interface ComponentsObject extends OpenAPIExtensions { 78 67 /** 79 68 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#callback-object Callback Objects}. 80 69 */ ··· 124 113 * email: support@example.com 125 114 * ``` 126 115 */ 127 - export interface ContactObject extends SpecificationExtensions { 116 + export interface ContactObject extends OpenAPIExtensions { 128 117 /** 129 118 * The email address of the contact person/organization. This MUST be in the form of an email address. 130 119 */ ··· 171 160 * TODO: default values examples 172 161 * TODO: examples 173 162 */ 174 - export interface EncodingObject extends SpecificationExtensions { 163 + export interface EncodingObject extends OpenAPIExtensions { 175 164 /** 176 165 * When this is true, parameter values are serialized using reserved expansion, as defined by {@link https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3 RFC6570}, which allows {@link https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 RFC3986's reserved character set}, as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are {@link https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 not allowed in the query string} (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#appendix-c-using-rfc6570-based-serialization C} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#appendix-e-percent-encoding-and-form-media-types E} for details. The default value is `false`. This field SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. 177 166 */ ··· 212 201 * 213 202 * TODO: examples 214 203 */ 215 - export interface ExampleObject extends SpecificationExtensions { 204 + export interface ExampleObject extends OpenAPIExtensions { 216 205 /** 217 206 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 218 207 */ ··· 243 232 * url: https://example.com 244 233 * ``` 245 234 */ 246 - export interface ExternalDocumentationObject extends SpecificationExtensions { 235 + export interface ExternalDocumentationObject extends OpenAPIExtensions { 247 236 /** 248 237 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 249 238 */ ··· 287 276 * version: 1.0.1 288 277 * ``` 289 278 */ 290 - export interface InfoObject extends SpecificationExtensions { 279 + export interface InfoObject extends OpenAPIExtensions { 291 280 /** 292 281 * The contact information for the exposed API. 293 282 */ ··· 324 313 * url: https://www.apache.org/licenses/LICENSE-2.0.html 325 314 * ``` 326 315 */ 327 - export interface LicenseObject extends SpecificationExtensions { 316 + export interface LicenseObject extends OpenAPIExtensions { 328 317 /** 329 318 * **REQUIRED**. The license name used for the API. 330 319 */ ··· 350 339 * 351 340 * TODO: examples 352 341 */ 353 - export interface LinkObject extends SpecificationExtensions { 342 + export interface LinkObject extends OpenAPIExtensions { 354 343 /** 355 344 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 356 345 */ ··· 386 375 * 387 376 * TODO: examples 388 377 */ 389 - export interface MediaTypeObject extends SpecificationExtensions { 378 + export interface MediaTypeObject extends OpenAPIExtensions { 390 379 /** 391 380 * A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The `encoding` field SHALL only apply to {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#request-body-object Request Body Objects}, and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. 392 381 */ ··· 412 401 * 413 402 * TODO: examples 414 403 */ 415 - export interface OAuthFlowObject extends SpecificationExtensions { 404 + export interface OAuthFlowObject extends OpenAPIExtensions { 416 405 /** 417 406 * **REQUIRED (`"implicit"`, `"authorizationCode"`)**. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. 418 407 */ ··· 436 425 * 437 426 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 438 427 */ 439 - export interface OAuthFlowsObject extends SpecificationExtensions { 428 + export interface OAuthFlowsObject extends OpenAPIExtensions { 440 429 /** 441 430 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 442 431 */ ··· 462 451 * 463 452 * TODO: examples 464 453 */ 465 - export interface OperationObject extends SpecificationExtensions { 454 + export interface OperationObject extends OpenAPIExtensions { 466 455 /** 467 456 * A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#callback-object Callback Object} that describes a request that may be initiated by the API provider and the expected responses. 468 457 */ ··· 561 550 * 562 551 * TODO: examples 563 552 */ 564 - export interface ParameterObject extends SpecificationExtensions { 553 + export interface ParameterObject extends OpenAPIExtensions { 565 554 /** 566 555 * If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#parameter-style `style`} is used, and if {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#style-examples behavior is _n/a_ (cannot be serialized)}, the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#schema-object Schema Object} are implementation-defined. This field is valid only for `query` parameters. Use of this field is NOT RECOMMENDED, and it is likely to be removed in a later revision. 567 556 */ ··· 633 622 * 634 623 * TODO: examples 635 624 */ 636 - export interface PathItemObject extends SpecificationExtensions { 625 + export interface PathItemObject extends OpenAPIExtensions { 637 626 /** 638 627 * Allows for a referenced definition of this path item. The value MUST be in the form of a URL, and the referenced structure MUST be in the form of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#path-item-object Path Item Object}. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#relative-references-in-urls Relative References}. 639 628 */ ··· 695 684 * 696 685 * TODO: examples 697 686 */ 698 - export interface PathsObject extends SpecificationExtensions { 687 + export interface PathsObject extends OpenAPIExtensions { 699 688 /** 700 689 * A relative path to an individual endpoint. The field name MUST begin with a forward slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#server-object Server Object}'s `url` field in order to construct the full URL. {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#path-templating Path templating} is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. 701 690 */ ··· 743 732 * 744 733 * TODO: examples 745 734 */ 746 - export interface RequestBodyObject extends SpecificationExtensions { 735 + export interface RequestBodyObject extends OpenAPIExtensions { 747 736 /** 748 737 * **REQUIRED**. The content of the request body. The key is a media type or {@link https://tools.ietf.org/html/rfc7231#appendix-D media type range} and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. `"text/plain"` overrides `"text/*"` 749 738 */ ··· 765 754 * 766 755 * TODO: examples 767 756 */ 768 - export interface ResponseObject extends SpecificationExtensions { 757 + export interface ResponseObject extends OpenAPIExtensions { 769 758 /** 770 759 * A map containing descriptions of potential response payloads. The key is a media type or {@link https://tools.ietf.org/html/rfc7231#appendix-D media type range} and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. `"text/plain"` overrides `"text/*"` 771 760 */ ··· 797 786 * 798 787 * TODO: examples 799 788 */ 800 - export interface ResponsesObject extends SpecificationExtensions { 789 + export interface ResponsesObject extends OpenAPIExtensions { 801 790 /** 802 791 * Any {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#http-status-codes HTTP status code} can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#reference-object Reference Object} can link to a response that is defined in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#components-responses OpenAPI Object's `components.responses`} section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `200` and `299`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. 803 792 */ ··· 859 848 * 860 849 * TODO: content, examples 861 850 */ 862 - export interface SchemaObject extends EnumExtensions, SpecificationExtensions { 851 + export interface SchemaObject extends EnumExtensions, OpenAPIExtensions { 863 852 /** 864 853 * The value of "additionalProperties" MUST be a boolean or a schema. 865 854 * ··· 1112 1101 * 1113 1102 * TODO: examples 1114 1103 */ 1115 - export type SecuritySchemeObject = SpecificationExtensions & { 1104 + export type SecuritySchemeObject = OpenAPIExtensions & { 1116 1105 /** 1117 1106 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1118 1107 */ ··· 1175 1164 * 1176 1165 * TODO: examples 1177 1166 */ 1178 - export interface ServerObject extends SpecificationExtensions { 1167 + export interface ServerObject extends OpenAPIExtensions { 1179 1168 /** 1180 1169 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1181 1170 */ ··· 1195 1184 * 1196 1185 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 1197 1186 */ 1198 - export interface ServerVariableObject extends SpecificationExtensions { 1187 + export interface ServerVariableObject extends OpenAPIExtensions { 1199 1188 /** 1200 1189 * **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. If the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#server-variable-enum `enum`} is defined, the value SHOULD exist in the enum's values. Note that this behavior is different from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#schema-object Schema Object}'s `default` keyword, which documents the receiver's behavior rather than inserting the value into the data. 1201 1190 */ ··· 1222 1211 * description: Pets operations 1223 1212 * ``` 1224 1213 */ 1225 - export interface TagObject extends SpecificationExtensions { 1214 + export interface TagObject extends OpenAPIExtensions { 1226 1215 /** 1227 1216 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1228 1217 */ ··· 1251 1240 * 1252 1241 * TODO: examples 1253 1242 */ 1254 - export interface XMLObject extends SpecificationExtensions { 1243 + export interface XMLObject extends OpenAPIExtensions { 1255 1244 /** 1256 1245 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 1257 1246 */ ··· 1287 1276 | 'date-time' 1288 1277 | 'password'; 1289 1278 1290 - type Format = JsonSchemaFormats | OpenApiSchemaFormats | AnyString; 1279 + type Format = JsonSchemaFormats | OpenApiSchemaFormats | (string & {});
-21
packages/shared/src/openApi/3.1.x/index.ts
··· 1 1 export { parseV3_1_X } from './parser'; 2 - export type { OpenApiV3_1_X } from './types/spec'; 3 - 4 - import type { 5 - InfoObject, 6 - OperationObject, 7 - ParameterObject, 8 - ReferenceObject, 9 - RequestBodyObject, 10 - ResponseObject, 11 - SchemaObject, 12 - } from './types/spec'; 13 - 14 - export interface OpenApiV3_1_XTypes { 15 - InfoObject: InfoObject; 16 - OperationObject: OperationObject; 17 - ParameterObject: ParameterObject; 18 - ReferenceObject: ReferenceObject; 19 - RequestBodyObject: RequestBodyObject; 20 - ResponseObject: ResponseObject; 21 - SchemaObject: SchemaObject; 22 - }
+4 -3
packages/shared/src/openApi/3.1.x/parser/__tests__/operation.test.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../../ir/context'; 2 - import type { SecuritySchemeObject } from '../../types/spec'; 3 4 import { parsePathOperation } from '../operation'; 4 5 5 6 type ParseOperationProps = Parameters<typeof parsePathOperation>[0]; ··· 38 39 }; 39 40 const path = '/test'; 40 41 41 - const oauth2: SecuritySchemeObject = { 42 + const oauth2: OpenAPIV3_1.SecuritySchemeObject = { 42 43 description: 'OAuth2', 43 44 flows: { 44 45 password: { ··· 51 52 }, 52 53 type: 'oauth2', 53 54 }; 54 - const securitySchemesMap = new Map<string, SecuritySchemeObject>([ 55 + const securitySchemesMap = new Map<string, OpenAPIV3_1.SecuritySchemeObject>([ 55 56 ['apiKeyAuth', { in: 'header', name: 'Auth', type: 'apiKey' }], 56 57 ['basicAuthRule', { description: 'Basic Auth', scheme: 'basic', type: 'http' }], 57 58 ['oauthRule', oauth2],
+4 -4
packages/shared/src/openApi/3.1.x/parser/filter.ts
··· 1 1 import type { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 3 3 4 import { createOperationKey } from '../../../ir/operation'; 4 5 import { addNamespace, removeNamespace } from '../../../openApi/shared/utils/filter'; 5 6 import { httpMethods } from '../../../openApi/shared/utils/operation'; 6 - import type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec'; 7 7 8 8 /** 9 9 * Replace source spec with filtered version. ··· 25 25 requestBodies: Set<string>; 26 26 responses: Set<string>; 27 27 schemas: Set<string>; 28 - spec: OpenApiV3_1_X; 28 + spec: OpenAPIV3_1.Document; 29 29 }) => { 30 30 const eventFilterSpec = logger.timeEvent('filter-spec'); 31 31 if (spec.components) { ··· 120 120 121 121 if (spec.paths) { 122 122 for (const entry of Object.entries(spec.paths)) { 123 - const path = entry[0] as keyof PathsObject; 124 - const pathItem = entry[1] as PathItemObject; 123 + const path = entry[0] as keyof OpenAPIV3_1.PathsObject; 124 + const pathItem = entry[1] as OpenAPIV3_1.PathItemObject; 125 125 126 126 for (const method of httpMethods) { 127 127 const operation = pathItem[method];
+11 -15
packages/shared/src/openApi/3.1.x/parser/index.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { buildResourceMetadata } from '../../../openApi/shared/graph/meta'; 3 5 import { transformOpenApiSpec } from '../../../openApi/shared/transforms'; ··· 10 12 import { buildGraph } from '../../../openApi/shared/utils/graph'; 11 13 import { mergeParametersObjects } from '../../../openApi/shared/utils/parameter'; 12 14 import { handleValidatorResult } from '../../../openApi/shared/utils/validator'; 13 - import type { 14 - OpenApiV3_1_X, 15 - ParameterObject, 16 - PathItemObject, 17 - PathsObject, 18 - RequestBodyObject, 19 - SecuritySchemeObject, 20 - } from '../types/spec'; 21 15 import { filterSpec } from './filter'; 22 16 import { parsePathOperation } from './operation'; 23 17 import { parametersArrayToObject, parseParameter } from './parameter'; ··· 27 21 import { validateOpenApiSpec } from './validate'; 28 22 import { parseWebhooks } from './webhook'; 29 23 30 - export const parseV3_1_X = (context: Context<OpenApiV3_1_X>) => { 24 + export const parseV3_1_X = (context: Context<OpenAPIV3_1.Document>) => { 31 25 if (context.config.parser.validate_EXPERIMENTAL) { 32 26 const result = validateOpenApiSpec(context.spec, context.logger); 33 27 handleValidatorResult({ context, result }); ··· 56 50 const state: State = { 57 51 ids: new Map(), 58 52 }; 59 - const securitySchemesMap = new Map<string, SecuritySchemeObject>(); 53 + const securitySchemesMap = new Map<string, OpenAPIV3_1.SecuritySchemeObject>(); 60 54 61 55 // TODO: parser - handle more component types, old parser handles only parameters and schemas 62 56 if (context.spec.components) { ··· 64 58 const securityOrReference = context.spec.components.securitySchemes[name]!; 65 59 const securitySchemeObject = 66 60 '$ref' in securityOrReference 67 - ? context.resolveRef<SecuritySchemeObject>(securityOrReference.$ref) 61 + ? context.resolveRef<OpenAPIV3_1.SecuritySchemeObject>(securityOrReference.$ref) 68 62 : securityOrReference; 69 63 securitySchemesMap.set(name, securitySchemeObject); 70 64 } ··· 74 68 const parameterOrReference = context.spec.components.parameters[name]!; 75 69 const parameter = 76 70 '$ref' in parameterOrReference 77 - ? context.resolveRef<ParameterObject>(parameterOrReference.$ref) 71 + ? context.resolveRef<OpenAPIV3_1.ParameterObject>(parameterOrReference.$ref) 78 72 : parameterOrReference; 79 73 80 74 parseParameter({ ··· 89 83 const requestBodyOrReference = context.spec.components.requestBodies[name]!; 90 84 const requestBody = 91 85 '$ref' in requestBodyOrReference 92 - ? context.resolveRef<RequestBodyObject>(requestBodyOrReference.$ref) 86 + ? context.resolveRef<OpenAPIV3_1.RequestBodyObject>(requestBodyOrReference.$ref) 93 87 : requestBodyOrReference; 94 88 95 89 parseRequestBody({ ··· 115 109 116 110 for (const path in context.spec.paths) { 117 111 if (path.startsWith('x-')) continue; 118 - const pathItem = context.spec.paths[path as keyof PathsObject]! as PathItemObject; 112 + const pathItem = context.spec.paths[ 113 + path as keyof OpenAPIV3_1.PathsObject 114 + ]! as OpenAPIV3_1.PathItemObject; 119 115 120 116 const finalPathItem = pathItem.$ref 121 117 ? { 122 - ...context.resolveRef<PathItemObject>(pathItem.$ref), 118 + ...context.resolveRef<OpenAPIV3_1.PathItemObject>(pathItem.$ref), 123 119 ...pathItem, 124 120 } 125 121 : pathItem;
+9 -4
packages/shared/src/openApi/3.1.x/parser/mediaType.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { IRMediaType } from '../../../ir/mediaType'; 2 4 import { isMediaTypeFileLike, mediaTypeToIrMediaType } from '../../../ir/mediaType'; 3 - import type { MediaTypeObject, SchemaObject } from '../types/spec'; 4 5 5 6 interface Content { 6 7 mediaType: string; 7 - schema: SchemaObject | undefined; 8 + schema: OpenAPIV3_1.SchemaObject | undefined; 8 9 type: IRMediaType | undefined; 9 10 } 10 11 11 - export const contentToSchema = ({ content }: { content: Content }): SchemaObject | undefined => { 12 + export const contentToSchema = ({ 13 + content, 14 + }: { 15 + content: Content; 16 + }): OpenAPIV3_1.SchemaObject | undefined => { 12 17 const { mediaType, schema } = content; 13 18 14 19 if (!schema) { ··· 34 39 export const mediaTypeObjects = ({ 35 40 content, 36 41 }: { 37 - content: Record<string, MediaTypeObject> | undefined; 42 + content: Record<string, OpenAPIV3_1.MediaTypeObject> | undefined; 38 43 }): ReadonlyArray<Content> => { 39 44 const objects: Array<Content> = []; 40 45
+12 -15
packages/shared/src/openApi/3.1.x/parser/operation.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import type { State } from '../../../openApi/shared/types/state'; 4 6 import type { httpMethods } from '../../../openApi/shared/utils/operation'; 5 7 import { operationToId } from '../../../openApi/shared/utils/operation'; 6 - import type { 7 - OperationObject, 8 - ReferenceObject, 9 - RequestBodyObject, 10 - ResponseObject, 11 - SecuritySchemeObject, 12 - } from '../types/spec'; 13 8 import { contentToSchema, mediaTypeObjects } from './mediaType'; 14 9 import { paginationField } from './pagination'; 15 10 import { parseExtensions, schemaToIrSchema } from './schema'; 16 11 17 12 export interface Operation 18 - extends Omit<OperationObject, 'parameters'>, Pick<IR.OperationObject, 'parameters'> {} 13 + extends Omit<OpenAPIV3_1.OperationObject, 'parameters'>, Pick<IR.OperationObject, 'parameters'> {} 19 14 20 15 const parseOperationJsDoc = ({ 21 16 irOperation, ··· 91 86 }: Pick<IR.OperationObject, 'method' | 'path'> & { 92 87 context: Context; 93 88 operation: Operation; 94 - securitySchemesMap: Map<string, SecuritySchemeObject>; 89 + securitySchemesMap: Map<string, OpenAPIV3_1.SecuritySchemeObject>; 95 90 state: State; 96 91 }): IR.OperationObject => { 97 92 const irOperation = initIrOperation({ ··· 109 104 if (operation.requestBody) { 110 105 const requestBody = 111 106 '$ref' in operation.requestBody 112 - ? context.resolveRef<RequestBodyObject>(operation.requestBody.$ref) 107 + ? context.resolveRef<OpenAPIV3_1.RequestBodyObject>(operation.requestBody.$ref) 113 108 : operation.requestBody; 114 109 const contents = mediaTypeObjects({ content: requestBody.content }); 115 110 // TODO: add support for multiple content types, for now prefer JSON ··· 158 153 irOperation.responses = {}; 159 154 } 160 155 161 - const response = operation.responses[name]! as ResponseObject | ReferenceObject; 156 + const response = operation.responses[name]! as 157 + | OpenAPIV3_1.ResponseObject 158 + | OpenAPIV3_1.ReferenceObject; 162 159 const responseObject = 163 - '$ref' in response ? context.resolveRef<ResponseObject>(response.$ref) : response; 160 + '$ref' in response ? context.resolveRef<OpenAPIV3_1.ResponseObject>(response.$ref) : response; 164 161 const contents = mediaTypeObjects({ content: responseObject.content }); 165 162 // TODO: add support for multiple content types, for now prefer JSON 166 163 const content = contents.find((content) => content.type === 'json') || contents[0]; ··· 227 224 method: (typeof httpMethods)[number]; 228 225 operation: Operation; 229 226 path: keyof IR.PathsObject; 230 - securitySchemesMap: Map<string, SecuritySchemeObject>; 227 + securitySchemesMap: Map<string, OpenAPIV3_1.SecuritySchemeObject>; 231 228 state: State; 232 229 }) => { 233 230 if (operation.servers) { ··· 256 253 method: (typeof httpMethods)[number]; 257 254 operation: Operation; 258 255 path: keyof IR.PathsObject; 259 - securitySchemesMap: Map<string, SecuritySchemeObject>; 256 + securitySchemesMap: Map<string, OpenAPIV3_1.SecuritySchemeObject>; 260 257 state: State; 261 258 }) => { 262 259 if (!context.ir.paths) { ··· 287 284 key: string; 288 285 method: (typeof httpMethods)[number]; 289 286 operation: Operation; 290 - securitySchemesMap: Map<string, SecuritySchemeObject>; 287 + securitySchemesMap: Map<string, OpenAPIV3_1.SecuritySchemeObject>; 291 288 state: State; 292 289 }) => { 293 290 if (!context.ir.webhooks) {
+10 -6
packages/shared/src/openApi/3.1.x/parser/pagination.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { getPaginationKeywordsRegExp } from '../../../ir/pagination'; 3 5 import type { SchemaType } from '../../../openApi/shared/types/schema'; 4 - import type { ParameterObject, RequestBodyObject } from '../types/spec'; 5 - import type { SchemaObject } from '../types/spec'; 6 6 import { mediaTypeObjects } from './mediaType'; 7 7 import { getSchemaTypes } from './schema'; 8 8 9 - const isPaginationType = (schemaTypes: ReadonlyArray<SchemaType<SchemaObject>>): boolean => 9 + const isPaginationType = ( 10 + schemaTypes: ReadonlyArray<SchemaType<OpenAPIV3_1.SchemaObject>>, 11 + ): boolean => 10 12 schemaTypes.includes('boolean') || 11 13 schemaTypes.includes('integer') || 12 14 schemaTypes.includes('number') || ··· 20 22 }: { 21 23 context: Context; 22 24 name: string; 23 - schema: SchemaObject; 25 + schema: OpenAPIV3_1.SchemaObject; 24 26 }): boolean | string => { 25 27 const paginationRegExp = getPaginationKeywordsRegExp(context.config.parser.pagination); 26 28 if (paginationRegExp.test(name)) { ··· 28 30 } 29 31 30 32 if (schema.$ref) { 31 - const ref = context.resolveRef<ParameterObject | RequestBodyObject | SchemaObject>(schema.$ref); 33 + const ref = context.resolveRef< 34 + OpenAPIV3_1.ParameterObject | OpenAPIV3_1.RequestBodyObject | OpenAPIV3_1.SchemaObject 35 + >(schema.$ref); 32 36 33 37 if ('content' in ref || 'in' in ref) { 34 - let refSchema: SchemaObject | undefined; 38 + let refSchema: OpenAPIV3_1.SchemaObject | undefined; 35 39 36 40 if ('in' in ref) { 37 41 refSchema = ref.schema;
+12 -9
packages/shared/src/openApi/3.1.x/parser/parameter.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import { refToName } from '../../../utils/ref'; 4 - import type { ParameterObject, ReferenceObject, SchemaObject } from '../types/spec'; 5 6 import { mediaTypeObjects } from './mediaType'; 6 7 import { paginationField } from './pagination'; 7 8 import { parseExtensions, schemaToIrSchema } from './schema'; ··· 9 10 /** 10 11 * Returns default parameter `allowReserved` based on value of `in`. 11 12 */ 12 - const defaultAllowReserved = (_in: ParameterObject['in']): boolean | undefined => { 13 + const defaultAllowReserved = (_in: OpenAPIV3_1.ParameterObject['in']): boolean | undefined => { 13 14 switch (_in) { 14 15 // this keyword only applies to parameters with an `in` value of `query` 15 16 case 'query': ··· 22 23 /** 23 24 * Returns default parameter `explode` based on value of `style`. 24 25 */ 25 - const defaultExplode = (style: Required<ParameterObject>['style']): boolean => { 26 + const defaultExplode = (style: Required<OpenAPIV3_1.ParameterObject>['style']): boolean => { 26 27 switch (style) { 27 28 // default value for `deepObject` is `false`, but that behavior is undefined 28 29 // so we use `true` to make this work with the `client-fetch` package ··· 37 38 /** 38 39 * Returns default parameter `style` based on value of `in`. 39 40 */ 40 - const defaultStyle = (_in: ParameterObject['in']): Required<ParameterObject>['style'] => { 41 + const defaultStyle = ( 42 + _in: OpenAPIV3_1.ParameterObject['in'], 43 + ): Required<OpenAPIV3_1.ParameterObject>['style'] => { 41 44 switch (_in) { 42 45 case 'header': 43 46 case 'path': ··· 53 56 parameters, 54 57 }: { 55 58 context: Context; 56 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 59 + parameters?: ReadonlyArray<OpenAPIV3_1.ParameterObject | OpenAPIV3_1.ReferenceObject>; 57 60 }): IR.ParametersObject | undefined => { 58 61 if (!parameters || !Object.keys(parameters).length) { 59 62 return; ··· 64 67 for (const parameterOrReference of parameters) { 65 68 const parameter = 66 69 '$ref' in parameterOrReference 67 - ? context.dereference<ParameterObject>(parameterOrReference) 70 + ? context.dereference<OpenAPIV3_1.ParameterObject>(parameterOrReference) 68 71 : parameterOrReference; 69 72 70 73 if (!parametersObject[parameter.in]) { ··· 89 92 }: { 90 93 $ref: string; 91 94 context: Context; 92 - parameter: ParameterObject; 95 + parameter: OpenAPIV3_1.ParameterObject; 93 96 }): IR.ParameterObject => { 94 97 // TODO: parser - fix 95 98 let schema = parameter.schema; ··· 103 106 } 104 107 } 105 108 106 - const finalSchema: SchemaObject = { 109 + const finalSchema: OpenAPIV3_1.SchemaObject = { 107 110 deprecated: parameter.deprecated, 108 111 description: parameter.description, 109 112 ...schema, ··· 169 172 }: { 170 173 $ref: string; 171 174 context: Context; 172 - parameter: ParameterObject; 175 + parameter: OpenAPIV3_1.ParameterObject; 173 176 }) => { 174 177 if (!context.ir.components) { 175 178 context.ir.components = {};
+5 -4
packages/shared/src/openApi/3.1.x/parser/requestBody.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import type { IR } from '../../../ir/types'; 3 5 import { refToName } from '../../../utils/ref'; 4 - import type { RequestBodyObject, SchemaObject } from '../types/spec'; 5 6 import { mediaTypeObjects } from './mediaType'; 6 7 import { schemaToIrSchema } from './schema'; 7 8 ··· 12 13 }: { 13 14 $ref: string; 14 15 context: Context; 15 - requestBody: RequestBodyObject; 16 + requestBody: OpenAPIV3_1.RequestBodyObject; 16 17 }): IR.RequestBodyObject => { 17 18 // TODO: parser - fix 18 19 const contents = mediaTypeObjects({ content: requestBody.content }); ··· 20 21 const content = contents.find((content) => content.type === 'json') || contents[0]; 21 22 const schema = content ? content.schema : undefined; 22 23 23 - const finalSchema: SchemaObject = { 24 + const finalSchema: OpenAPIV3_1.SchemaObject = { 24 25 description: requestBody.description, 25 26 ...schema, 26 27 }; ··· 54 55 }: { 55 56 $ref: string; 56 57 context: Context; 57 - requestBody: RequestBodyObject; 58 + requestBody: OpenAPIV3_1.RequestBodyObject; 58 59 }) => { 59 60 if (!context.ir.components) { 60 61 context.ir.components = {};
+56 -53
packages/shared/src/openApi/3.1.x/parser/schema.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { isMediaTypeFileLike } from '../../../ir/mediaType'; 3 5 import type { IR } from '../../../ir/types'; ··· 13 15 discriminatorValues, 14 16 } from '../../../openApi/shared/utils/discriminator'; 15 17 import { isTopLevelComponent, refToName } from '../../../utils/ref'; 16 - import type { SchemaObject } from '../types/spec'; 17 18 18 19 export const getSchemaTypes = ({ 19 20 schema, 20 21 }: { 21 - schema: SchemaObject; 22 - }): ReadonlyArray<SchemaType<SchemaObject>> => { 22 + schema: OpenAPIV3_1.SchemaObject; 23 + }): ReadonlyArray<SchemaType<OpenAPIV3_1.SchemaObject>> => { 23 24 if (typeof schema.type === 'string') { 24 25 return [schema.type]; 25 26 } ··· 47 48 }: { 48 49 context: Context; 49 50 propertyName: string; 50 - schemas: ReadonlyArray<SchemaObject>; 51 + schemas: ReadonlyArray<OpenAPIV3_1.SchemaObject>; 51 52 }): DiscriminatorPropertyType => { 52 53 for (const schema of schemas) { 53 - const resolved = schema.$ref ? context.resolveRef<SchemaObject>(schema.$ref) : schema; 54 + const resolved = schema.$ref 55 + ? context.resolveRef<OpenAPIV3_1.SchemaObject>(schema.$ref) 56 + : schema; 54 57 55 58 // Check direct properties 56 59 const property = resolved.properties?.[propertyName]; ··· 59 62 } 60 63 if (property) { 61 64 const resolvedProperty = property.$ref 62 - ? context.resolveRef<SchemaObject>(property.$ref) 65 + ? context.resolveRef<OpenAPIV3_1.SchemaObject>(property.$ref) 63 66 : property; 64 67 // Handle both single type and array of types (3.1.x supports type arrays) 65 68 const propertyTypes = Array.isArray(resolvedProperty.type) ··· 102 105 }: { 103 106 context: Context; 104 107 discriminators?: Array<{ 105 - discriminator: NonNullable<SchemaObject['discriminator']>; 106 - oneOf?: SchemaObject['oneOf']; 108 + discriminator: NonNullable<OpenAPIV3_1.SchemaObject['discriminator']>; 109 + oneOf?: OpenAPIV3_1.SchemaObject['oneOf']; 107 110 }>; 108 - schema: SchemaObject; 111 + schema: OpenAPIV3_1.SchemaObject; 109 112 }): Array<{ 110 - discriminator: NonNullable<SchemaObject['discriminator']>; 111 - oneOf?: SchemaObject['oneOf']; 113 + discriminator: NonNullable<OpenAPIV3_1.SchemaObject['discriminator']>; 114 + oneOf?: OpenAPIV3_1.SchemaObject['oneOf']; 112 115 }> => { 113 116 // Check if this schema has a discriminator 114 117 if (schema.discriminator) { ··· 121 124 // If this schema is an allOf composition, recursively search in its components 122 125 if (schema.allOf) { 123 126 for (const compositionSchema of schema.allOf) { 124 - let resolvedSchema: SchemaObject; 127 + let resolvedSchema: OpenAPIV3_1.SchemaObject; 125 128 if (compositionSchema.$ref) { 126 - resolvedSchema = context.resolveRef<SchemaObject>(compositionSchema.$ref); 129 + resolvedSchema = context.resolveRef<OpenAPIV3_1.SchemaObject>(compositionSchema.$ref); 127 130 } else { 128 131 resolvedSchema = compositionSchema; 129 132 } ··· 147 150 discriminator, 148 151 schemaRef, 149 152 }: { 150 - discriminator: NonNullable<SchemaObject['discriminator']>; 153 + discriminator: NonNullable<OpenAPIV3_1.SchemaObject['discriminator']>; 151 154 schemaRef: string; 152 155 }): Array<string> => { 153 156 const values: Array<string> = []; ··· 168 171 schema, 169 172 }: { 170 173 irSchema: IR.SchemaObject; 171 - schema: SchemaObject; 174 + schema: OpenAPIV3_1.SchemaObject; 172 175 }) => { 173 176 if (schema.deprecated !== undefined) { 174 177 irSchema.deprecated = schema.deprecated; ··· 192 195 schema, 193 196 }: { 194 197 irSchema: IR.SchemaObject; 195 - schema: SchemaObject; 198 + schema: OpenAPIV3_1.SchemaObject; 196 199 }) => { 197 200 if (schema.const !== undefined) { 198 201 irSchema.const = schema.const; ··· 282 285 }: { 283 286 context: Context; 284 287 irSchema?: IR.SchemaObject; 285 - schema: SchemaObject; 288 + schema: OpenAPIV3_1.SchemaObject; 286 289 state: SchemaState; 287 290 }): IR.SchemaObject => { 288 291 if ( ··· 346 349 }: { 347 350 context: Context; 348 351 irSchema?: IR.SchemaObject; 349 - schema: SchemaObject; 352 + schema: OpenAPIV3_1.SchemaObject; 350 353 }): IR.SchemaObject => { 351 354 irSchema.type = 'boolean'; 352 355 ··· 358 361 }: { 359 362 context: Context; 360 363 irSchema?: IR.SchemaObject; 361 - schema: SchemaObject; 364 + schema: OpenAPIV3_1.SchemaObject; 362 365 }) => { 363 366 irSchema.type = 'null'; 364 367 ··· 371 374 }: { 372 375 context: Context; 373 376 irSchema?: IR.SchemaObject; 374 - schema: Omit<SchemaObject, 'type'> & { 375 - type: SchemaType<SchemaObject>; 377 + schema: Omit<OpenAPIV3_1.SchemaObject, 'type'> & { 378 + type: SchemaType<OpenAPIV3_1.SchemaObject>; 376 379 }; 377 380 }): IR.SchemaObject => { 378 381 irSchema.type = schema.type; ··· 388 391 }: { 389 392 context: Context; 390 393 irSchema?: IR.SchemaObject; 391 - schema: SchemaObject; 394 + schema: OpenAPIV3_1.SchemaObject; 392 395 state: SchemaState; 393 396 }): IR.SchemaObject => { 394 397 irSchema.type = 'object'; ··· 510 513 }: { 511 514 context: Context; 512 515 irSchema?: IR.SchemaObject; 513 - schema: SchemaObject; 516 + schema: OpenAPIV3_1.SchemaObject; 514 517 }): IR.SchemaObject => { 515 518 irSchema.type = 'string'; 516 519 ··· 525 528 } 526 529 }; 527 530 528 - const initIrSchema = ({ schema }: { schema: SchemaObject }): IR.SchemaObject => { 531 + const initIrSchema = ({ schema }: { schema: OpenAPIV3_1.SchemaObject }): IR.SchemaObject => { 529 532 const irSchema: IR.SchemaObject = {}; 530 533 531 534 parseSchemaJsDoc({ ··· 547 550 state, 548 551 }: { 549 552 context: Context; 550 - schema: SchemaWithRequired<SchemaObject, 'allOf'>; 553 + schema: SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'allOf'>; 551 554 state: SchemaState; 552 555 }): IR.SchemaObject => { 553 556 let irSchema = initIrSchema({ schema }); ··· 560 563 561 564 // Collect discriminator information to add after all compositions are processed 562 565 type DiscriminatorInfo = { 563 - discriminator: NonNullable<SchemaObject['discriminator']>; 566 + discriminator: NonNullable<OpenAPIV3_1.SchemaObject['discriminator']>; 564 567 isExplicitMapping: boolean; 565 568 isRequired: boolean; 566 569 values: ReadonlyArray<string>; ··· 594 597 schemaItems.push(irCompositionSchema); 595 598 596 599 if (compositionSchema.$ref) { 597 - const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref); 600 + const ref = context.resolveRef<OpenAPIV3_1.SchemaObject>(compositionSchema.$ref); 598 601 // `$ref` should be passed from the root `parseSchema()` call 599 602 if (state.$ref) { 600 603 // Find all discriminators in the referenced schema, including nested allOf compositions ··· 644 647 (ref.allOf && 645 648 ref.allOf.some((item) => { 646 649 const resolvedItem = item.$ref 647 - ? context.resolveRef<SchemaObject>(item.$ref) 650 + ? context.resolveRef<OpenAPIV3_1.SchemaObject>(item.$ref) 648 651 : item; 649 652 return resolvedItem.required?.includes(d.discriminator.propertyName); 650 653 }))), ··· 699 702 const hasProperty = (() => { 700 703 if (!item.$ref) return false; 701 704 try { 702 - const refSchema = context.resolveRef<SchemaObject>(item.$ref); 705 + const refSchema = context.resolveRef<OpenAPIV3_1.SchemaObject>(item.$ref); 703 706 // Check if the discriminator property exists in the ref schema 704 707 return ( 705 708 refSchema.properties?.[discriminator.propertyName] !== undefined || 706 709 (refSchema.allOf && 707 710 refSchema.allOf.some((allOfItem) => { 708 711 const resolved = allOfItem.$ref 709 - ? context.resolveRef<SchemaObject>(allOfItem.$ref) 712 + ? context.resolveRef<OpenAPIV3_1.SchemaObject>(allOfItem.$ref) 710 713 : allOfItem; 711 714 return resolved.properties?.[discriminator.propertyName] !== undefined; 712 715 })) ··· 786 789 for (const compositionSchema of compositionSchemas) { 787 790 // TODO: parser - this could be probably resolved more accurately 788 791 const finalCompositionSchema = compositionSchema.$ref 789 - ? context.resolveRef<SchemaObject>(compositionSchema.$ref) 792 + ? context.resolveRef<OpenAPIV3_1.SchemaObject>(compositionSchema.$ref) 790 793 : compositionSchema; 791 794 792 795 if (getSchemaTypes({ schema: finalCompositionSchema }).includes('object')) { ··· 846 849 state, 847 850 }: { 848 851 context: Context; 849 - schema: SchemaWithRequired<SchemaObject, 'anyOf'>; 852 + schema: SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'anyOf'>; 850 853 state: SchemaState; 851 854 }): IR.SchemaObject => { 852 855 let irSchema = initIrSchema({ schema }); ··· 938 941 state, 939 942 }: { 940 943 context: Context; 941 - schema: SchemaWithRequired<SchemaObject, 'enum'>; 944 + schema: SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'enum'>; 942 945 state: SchemaState; 943 946 }): IR.SchemaObject => { 944 947 let irSchema = initIrSchema({ schema }); ··· 950 953 951 954 for (const [index, enumValue] of schema.enum.entries()) { 952 955 const typeOfEnumValue = typeof enumValue; 953 - let enumType: SchemaType<SchemaObject> | undefined; 956 + let enumType: SchemaType<OpenAPIV3_1.SchemaObject> | undefined; 954 957 955 958 if ( 956 959 typeOfEnumValue === 'string' || ··· 1005 1008 state, 1006 1009 }: { 1007 1010 context: Context; 1008 - schema: SchemaWithRequired<SchemaObject, 'oneOf'>; 1011 + schema: SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'oneOf'>; 1009 1012 state: SchemaState; 1010 1013 }): IR.SchemaObject => { 1011 1014 let irSchema = initIrSchema({ schema }); ··· 1109 1112 state, 1110 1113 }: { 1111 1114 context: Context; 1112 - schema: SchemaWithRequired<SchemaObject, '$ref'>; 1115 + schema: SchemaWithRequired<OpenAPIV3_1.SchemaObject, '$ref'>; 1113 1116 state: SchemaState; 1114 1117 }): IR.SchemaObject => { 1115 1118 // Inline non-component refs (e.g. #/paths/...) and deep path refs (e.g. #/components/schemas/Foo/properties/bar) ··· 1117 1120 const isComponentsRef = isTopLevelComponent(schema.$ref); 1118 1121 if (!isComponentsRef) { 1119 1122 if (!state.circularReferenceTracker.has(schema.$ref)) { 1120 - const refSchema = context.resolveRef<SchemaObject>(schema.$ref); 1123 + const refSchema = context.resolveRef<OpenAPIV3_1.SchemaObject>(schema.$ref); 1121 1124 const originalRef = state.$ref; 1122 1125 state.$ref = schema.$ref; 1123 1126 const irSchema = schemaToIrSchema({ ··· 1141 1144 irRefSchema.$ref = decodeURI(schema.$ref); 1142 1145 1143 1146 if (!state.circularReferenceTracker.has(schema.$ref)) { 1144 - const refSchema = context.resolveRef<SchemaObject>(schema.$ref); 1147 + const refSchema = context.resolveRef<OpenAPIV3_1.SchemaObject>(schema.$ref); 1145 1148 const originalRef = state.$ref; 1146 1149 state.$ref = schema.$ref; 1147 1150 schemaToIrSchema({ ··· 1178 1181 }: { 1179 1182 context: Context; 1180 1183 irSchema?: IR.SchemaObject; 1181 - schema: Omit<SchemaObject, 'type'> & { 1182 - type: SchemaType<SchemaObject>; 1184 + schema: Omit<OpenAPIV3_1.SchemaObject, 'type'> & { 1185 + type: SchemaType<OpenAPIV3_1.SchemaObject>; 1183 1186 }; 1184 1187 state: SchemaState; 1185 1188 }): IR.SchemaObject => { ··· 1242 1245 }: { 1243 1246 context: Context; 1244 1247 irSchema?: IR.SchemaObject; 1245 - schema: Omit<SchemaObject, 'type'> & { 1246 - type: ReadonlyArray<SchemaType<SchemaObject>>; 1248 + schema: Omit<OpenAPIV3_1.SchemaObject, 'type'> & { 1249 + type: ReadonlyArray<SchemaType<OpenAPIV3_1.SchemaObject>>; 1247 1250 }; 1248 1251 state: SchemaState; 1249 1252 }): IR.SchemaObject => { ··· 1295 1298 state, 1296 1299 }: { 1297 1300 context: Context; 1298 - schema: SchemaWithRequired<SchemaObject, 'type'>; 1301 + schema: SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'type'>; 1299 1302 state: SchemaState; 1300 1303 }): IR.SchemaObject => { 1301 1304 const irSchema = initIrSchema({ schema }); ··· 1333 1336 }: { 1334 1337 context: Context; 1335 1338 irSchema?: IR.SchemaObject; 1336 - schema: SchemaObject; 1339 + schema: OpenAPIV3_1.SchemaObject; 1337 1340 }): IR.SchemaObject => { 1338 1341 if (!irSchema) { 1339 1342 irSchema = initIrSchema({ schema }); ··· 1352 1355 state, 1353 1356 }: { 1354 1357 context: Context; 1355 - schema: SchemaObject; 1358 + schema: OpenAPIV3_1.SchemaObject; 1356 1359 state: SchemaState | undefined; 1357 1360 }): IR.SchemaObject => { 1358 1361 if (!state) { ··· 1368 1371 if (schema.$ref) { 1369 1372 return parseRef({ 1370 1373 context, 1371 - schema: schema as SchemaWithRequired<SchemaObject, '$ref'>, 1374 + schema: schema as SchemaWithRequired<OpenAPIV3_1.SchemaObject, '$ref'>, 1372 1375 state, 1373 1376 }); 1374 1377 } ··· 1376 1379 if (schema.enum) { 1377 1380 return parseEnum({ 1378 1381 context, 1379 - schema: schema as SchemaWithRequired<SchemaObject, 'enum'>, 1382 + schema: schema as SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'enum'>, 1380 1383 state, 1381 1384 }); 1382 1385 } ··· 1384 1387 if (schema.allOf) { 1385 1388 return parseAllOf({ 1386 1389 context, 1387 - schema: schema as SchemaWithRequired<SchemaObject, 'allOf'>, 1390 + schema: schema as SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'allOf'>, 1388 1391 state, 1389 1392 }); 1390 1393 } ··· 1392 1395 if (schema.anyOf) { 1393 1396 return parseAnyOf({ 1394 1397 context, 1395 - schema: schema as SchemaWithRequired<SchemaObject, 'anyOf'>, 1398 + schema: schema as SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'anyOf'>, 1396 1399 state, 1397 1400 }); 1398 1401 } ··· 1400 1403 if (schema.oneOf) { 1401 1404 return parseOneOf({ 1402 1405 context, 1403 - schema: schema as SchemaWithRequired<SchemaObject, 'oneOf'>, 1406 + schema: schema as SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'oneOf'>, 1404 1407 state, 1405 1408 }); 1406 1409 } ··· 1409 1412 if (schema.type || schema.properties) { 1410 1413 return parseType({ 1411 1414 context, 1412 - schema: schema as SchemaWithRequired<SchemaObject, 'type'>, 1415 + schema: schema as SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'type'>, 1413 1416 state, 1414 1417 }); 1415 1418 } ··· 1418 1421 if (schema.contentMediaType && isMediaTypeFileLike({ mediaType: schema.contentMediaType })) { 1419 1422 return parseType({ 1420 1423 context, 1421 - schema: { ...schema, type: 'string' } as SchemaWithRequired<SchemaObject, 'type'>, 1424 + schema: { ...schema, type: 'string' } as SchemaWithRequired<OpenAPIV3_1.SchemaObject, 'type'>, 1422 1425 state, 1423 1426 }); 1424 1427 } ··· 1433 1436 }: { 1434 1437 $ref: string; 1435 1438 context: Context; 1436 - schema: SchemaObject; 1439 + schema: OpenAPIV3_1.SchemaObject; 1437 1440 }) => { 1438 1441 if (!context.ir.components) { 1439 1442 context.ir.components = {};
+7 -4
packages/shared/src/openApi/3.1.x/parser/validate.ts
··· 1 1 import type { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 3 3 4 import { createOperationKey } from '../../../ir/operation'; 4 5 import { httpMethods } from '../../../openApi/shared/utils/operation'; 5 6 import type { ValidatorIssue, ValidatorResult } from '../../../openApi/shared/utils/validator'; 6 - import type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec'; 7 7 8 - export const validateOpenApiSpec = (spec: OpenApiV3_1_X, logger: Logger): ValidatorResult => { 8 + export const validateOpenApiSpec = ( 9 + spec: OpenAPIV3_1.Document, 10 + logger: Logger, 11 + ): ValidatorResult => { 9 12 const eventValidate = logger.timeEvent('validate'); 10 13 const issues: Array<ValidatorIssue> = []; 11 14 const operationIds = new Map(); 12 15 13 16 if (spec.paths) { 14 17 for (const entry of Object.entries(spec.paths)) { 15 - const path = entry[0] as keyof PathsObject; 16 - const pathItem = entry[1] as PathItemObject; 18 + const path = entry[0] as keyof OpenAPIV3_1.PathsObject; 19 + const pathItem = entry[1] as OpenAPIV3_1.PathItemObject; 17 20 for (const method of httpMethods) { 18 21 const operation = pathItem[method]; 19 22 if (!operation) {
+4 -3
packages/shared/src/openApi/3.1.x/parser/webhook.ts
··· 1 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 + 1 3 import type { Context } from '../../../ir/context'; 2 4 import { mergeParametersObjects } from '../../../openApi/shared/utils/parameter'; 3 - import type { OpenApiV3_1_X, PathItemObject } from '../types/spec'; 4 5 import { parseWebhookOperation } from './operation'; 5 6 import { parametersArrayToObject } from './parameter'; 6 7 ··· 8 9 context, 9 10 securitySchemesMap, 10 11 }: Pick<Parameters<typeof parseWebhookOperation>[0], 'securitySchemesMap'> & { 11 - context: Context<OpenApiV3_1_X>; 12 + context: Context<OpenAPIV3_1.Document>; 12 13 }) => { 13 14 const state: Parameters<typeof parseWebhookOperation>[0]['state'] = { 14 15 ids: new Map(), ··· 20 21 const finalWebhook = 21 22 '$ref' in webhook 22 23 ? { 23 - ...context.resolveRef<PathItemObject>(webhook.$ref!), 24 + ...context.resolveRef<OpenAPIV3_1.PathItemObject>(webhook.$ref!), 24 25 ...webhook, 25 26 } 26 27 : webhook;
+35 -29
packages/shared/src/openApi/3.1.x/types/json-schema-draft-2020-12.ts packages/spec-types/src/json-schema/draft-2020-12/spec.ts
··· 1 1 import type { AnyString, MaybeArray } from '@hey-api/types'; 2 2 3 - import type { EnumExtensions } from '../../../openApi/shared/types'; 4 - import type { SpecificationExtensions } from './spec'; 5 - import type { OpenApiSchemaExtensions } from './spec-extensions'; 3 + import type { EnumExtensions, OpenAPIExtensions } from '../../extensions/openapi'; 4 + import type { OpenAPIV3_1SchemaExtensions } from '../../openapi/v3-1/extensions'; 6 5 7 6 // TODO: left out some keywords related to structuring a complex schema and declaring a dialect 8 - export interface JsonSchemaDraft2020_12 7 + export interface Document 9 8 extends 10 9 ArrayKeywords, 11 10 NumberKeywords, 12 11 ObjectKeywords, 13 12 StringKeywords, 14 13 EnumExtensions, 15 - OpenApiSchemaExtensions, 16 - SpecificationExtensions { 14 + OpenAPIV3_1SchemaExtensions, 15 + OpenAPIExtensions { 17 16 /** 18 17 * The `$comment` {@link https://json-schema.org/learn/glossary#keyword keyword} is strictly intended for adding comments to a schema. Its value must always be a string. Unlike the annotations `title`, `description`, and `examples`, JSON schema {@link https://json-schema.org/learn/glossary#implementation implementations} aren't allowed to attach any meaning or behavior to it whatsoever, and may even strip them at any time. Therefore, they are useful for leaving notes to future editors of a JSON schema, but should not be used to communicate to users of the schema. 19 18 */ ··· 31 30 * 32 31 * {@link https://json-schema.org/understanding-json-schema/reference/combining#allof allOf} can not be used to "extend" a schema to add more details to it in the sense of object-oriented inheritance. {@link https://json-schema.org/learn/glossary#instance Instances} must independently be valid against "all of" the schemas in the `allOf`. See the section on {@link https://json-schema.org/understanding-json-schema/reference/object#extending Extending Closed Schemas} for more information. 33 32 */ 34 - allOf?: ReadonlyArray<JsonSchemaDraft2020_12>; 33 + allOf?: ReadonlyArray<Document>; 35 34 /** 36 35 * `anyOf`: (OR) Must be valid against _any_ of the subschemas 37 36 * 38 37 * To validate against `anyOf`, the given data must be valid against any (one or more) of the given subschemas. 39 38 */ 40 - anyOf?: ReadonlyArray<JsonSchemaDraft2020_12>; 39 + anyOf?: ReadonlyArray<Document>; 41 40 /** 42 41 * The `const` keyword is used to restrict a value to a single value. 43 42 */ ··· 67 66 /** 68 67 * The `dependentSchemas` keyword conditionally applies a {@link https://json-schema.org/learn/glossary#subschema subschema} when a given property is present. This schema is applied in the same way {@link https://json-schema.org/understanding-json-schema/reference/combining#allof allOf} applies schemas. Nothing is merged or extended. Both schemas apply independently. 69 68 */ 70 - dependentSchemas?: Record<string, JsonSchemaDraft2020_12>; 69 + dependentSchemas?: Record<string, Document>; 71 70 /** 72 71 * The `deprecated` keyword is a boolean that indicates that the {@link https://json-schema.org/learn/glossary#instance instance} value the keyword applies to should not be used and may be removed in the future. 73 72 */ ··· 85 84 * 86 85 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored. 87 86 */ 88 - else?: JsonSchemaDraft2020_12; 87 + else?: Document; 89 88 /** 90 89 * The `enum` {@link https://json-schema.org/learn/glossary#keyword keyword} is used to restrict a value to a fixed set of values. It must be an array with at least one element, where each element is unique. 91 90 * ··· 113 112 * 114 113 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored. 115 114 */ 116 - if?: JsonSchemaDraft2020_12; 115 + if?: Document; 117 116 /** 118 117 * `not`: (NOT) Must _not_ be valid against the given schema 119 118 * 120 119 * The `not` keyword declares that an instance validates if it doesn't validate against the given subschema. 121 120 */ 122 - not?: JsonSchemaDraft2020_12; 121 + not?: Document; 123 122 /** 124 123 * `oneOf`: (XOR) Must be valid against _exactly one_ of the subschemas 125 124 * ··· 127 126 * 128 127 * Careful consideration should be taken when using `oneOf` entries as the nature of it requires verification of _every_ sub-schema which can lead to increased processing times. Prefer `anyOf` where possible. 129 128 */ 130 - oneOf?: ReadonlyArray<JsonSchemaDraft2020_12>; 129 + oneOf?: ReadonlyArray<Document>; 131 130 /** 132 131 * The boolean keywords `readOnly` and `writeOnly` are typically used in an API context. `readOnly` indicates that a value should not be modified. It could be used to indicate that a `PUT` request that changes a value would result in a `400 Bad Request` response. `writeOnly` indicates that a value may be set, but will remain hidden. In could be used to indicate you can set a value with a `PUT` request, but it would not be included when retrieving that record with a `GET` request. 133 132 */ ··· 141 140 * 142 141 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored. 143 142 */ 144 - then?: JsonSchemaDraft2020_12; 143 + then?: Document; 145 144 /** 146 145 * The `title` and `description` keywords must be strings. A "title" will preferably be short, whereas a "description" will provide a more lengthy explanation about the purpose of the data described by the schema. 147 146 */ ··· 156 155 writeOnly?: boolean; 157 156 } 158 157 159 - interface ArrayKeywords { 158 + export interface ArrayKeywords { 160 159 /** 161 160 * While the `items` schema must be valid for every item in the array, the `contains` schema only needs to validate against one or more items in the array. 162 161 */ 163 - contains?: JsonSchemaDraft2020_12; 162 + contains?: Document; 164 163 /** 165 164 * List validation is useful for arrays of arbitrary length where each item matches the same schema. For this kind of array, set the `items` {@link https://json-schema.org/learn/glossary#keyword keyword} to a single schema that will be used to validate all of the items in the array. 166 165 * ··· 168 167 * 169 168 * Note that `items` doesn't "see inside" any {@link https://json-schema.org/learn/glossary#instance instances} of `allOf`, `anyOf`, or `oneOf` in the same {@link https://json-schema.org/learn/glossary#subschema subschema}. 170 169 */ 171 - items?: JsonSchemaDraft2020_12 | false; 170 + items?: Document | false; 172 171 /** 173 172 * `minContains` and `maxContains` can be used with `contains` to further specify how many times a schema matches a `contains` constraint. These keywords can be any non-negative number including zero. 174 173 */ ··· 188 187 /** 189 188 * `prefixItems` is an array, where each item is a schema that corresponds to each index of the document's array. That is, an array where the first element validates the first element of the input array, the second element validates the second element of the input array, etc. 190 189 */ 191 - prefixItems?: ReadonlyArray<JsonSchemaDraft2020_12>; 190 + prefixItems?: ReadonlyArray<Document>; 192 191 /** 193 192 * The `unevaluatedItems` keyword is useful mainly when you want to add or disallow extra items to an array. 194 193 * ··· 198 197 * 199 198 * Like with `items`, if you set `unevaluatedItems` to false, you can disallow extra items in the array. 200 199 */ 201 - unevaluatedItems?: JsonSchemaDraft2020_12 | false; 200 + unevaluatedItems?: Document | false; 202 201 /** 203 202 * A schema can ensure that each of the items in an array is unique. Simply set the `uniqueItems` keyword to `true`. 204 203 */ 205 204 uniqueItems?: boolean; 206 205 } 207 206 208 - interface NumberKeywords { 207 + export interface NumberKeywords { 209 208 /** 210 209 * Ranges of numbers are specified using a combination of the `minimum` and `maximum` keywords, (or `exclusiveMinimum` and `exclusiveMaximum` for expressing exclusive range). 211 210 * ··· 272 271 multipleOf?: number; 273 272 } 274 273 275 - interface ObjectKeywords { 274 + export interface ObjectKeywords { 276 275 /** 277 276 * The `additionalProperties` keyword is used to control the handling of extra stuff, that is, properties whose names are not listed in the `properties` keyword or match any of the regular expressions in the `patternProperties` keyword. By default any additional properties are allowed. 278 277 * ··· 280 279 * 281 280 * It's important to note that `additionalProperties` only recognizes properties declared in the same {@link https://json-schema.org/learn/glossary#subschema subschema} as itself. So, `additionalProperties` can restrict you from "extending" a schema using {@link https://json-schema.org/understanding-json-schema/reference/combining combining} keywords such as {@link https://json-schema.org/understanding-json-schema/reference/combining#allof allOf}. 282 281 */ 283 - additionalProperties?: JsonSchemaDraft2020_12 | false; 282 + additionalProperties?: Document | false; 284 283 /** 285 284 * The number of properties on an object can be restricted using the `minProperties` and `maxProperties` keywords. Each of these must be a non-negative integer. 286 285 */ ··· 292 291 /** 293 292 * Sometimes you want to say that, given a particular kind of property name, the value should match a particular schema. That's where `patternProperties` comes in: it maps regular expressions to schemas. If a property name matches the given regular expression, the property value must validate against the corresponding schema. 294 293 */ 295 - patternProperties?: Record<string, JsonSchemaDraft2020_12>; 294 + patternProperties?: Record<string, Document>; 296 295 /** 297 296 * The properties (key-value pairs) on an object are defined using the `properties` {@link https://json-schema.org/learn/glossary#keyword keyword}. The value of `properties` is an object, where each key is the name of a property and each value is a {@link https://json-schema.org/learn/glossary#schema schema} used to validate that property. Any property that doesn't match any of the property names in the `properties` keyword is ignored by this keyword. 298 297 */ 299 - properties?: Record<string, JsonSchemaDraft2020_12 | true>; 298 + properties?: Record<string, Document | true>; 300 299 /** 301 300 * The names of properties can be validated against a schema, irrespective of their values. This can be useful if you don't want to enforce specific properties, but you want to make sure that the names of those properties follow a specific convention. You might, for example, want to enforce that all names are valid ASCII tokens so they can be used as attributes in a particular programming language. 302 301 * ··· 306 305 * { "type": "string" } 307 306 * ``` 308 307 */ 309 - propertyNames?: JsonSchemaDraft2020_12; 308 + propertyNames?: Document; 310 309 /** 311 310 * By default, the properties defined by the `properties` keyword are not required. However, one can provide a list of required properties using the `required` keyword. 312 311 * ··· 318 317 * 319 318 * `unevaluatedProperties` works by collecting any properties that are successfully validated when processing the schemas and using those as the allowed list of properties. This allows you to do more complex things like conditionally adding properties. 320 319 */ 321 - unevaluatedProperties?: JsonSchemaDraft2020_12 | false; 320 + unevaluatedProperties?: Document | false; 322 321 } 323 322 324 - interface StringKeywords { 323 + export interface StringKeywords { 325 324 /** 326 325 * The length of a string can be constrained using the `minLength` and `maxLength` {@link https://json-schema.org/learn/glossary#keyword keywords}. For both keywords, the value must be a non-negative number. 327 326 */ ··· 336 335 pattern?: string; 337 336 } 338 337 339 - type JsonSchemaFormats = 338 + export type JsonSchemaFormats = 340 339 | 'date' 341 340 | 'date-time' 342 341 | 'duration' ··· 358 357 | 'uuid' 359 358 | AnyString; 360 359 361 - type JsonSchemaTypes = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string'; 360 + export type JsonSchemaTypes = 361 + | 'array' 362 + | 'boolean' 363 + | 'integer' 364 + | 'null' 365 + | 'number' 366 + | 'object' 367 + | 'string';
+1 -1
packages/shared/src/openApi/3.1.x/types/spec-extensions.ts packages/spec-types/src/openapi/v3-1/extensions.ts
··· 1 1 import type { DiscriminatorObject, ExternalDocumentationObject, XMLObject } from './spec'; 2 2 3 - export interface OpenApiSchemaExtensions { 3 + export interface OpenAPIV3_1SchemaExtensions { 4 4 /** 5 5 * Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#composition-and-inheritance-polymorphism Composition and Inheritance} for more details. 6 6 */
+29 -38
packages/shared/src/openApi/3.1.x/types/spec.ts packages/spec-types/src/openapi/v3-1/spec.ts
··· 1 - import type { CodeSampleObject } from '../../../openApi/shared/types'; 2 - import type { JsonSchemaDraft2020_12 } from './json-schema-draft-2020-12'; 3 - 4 - /** 5 - * OpenAPI Specification Extensions. 6 - * 7 - * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 8 - */ 9 - export interface SpecificationExtensions { 10 - [extension: `x-${string}`]: unknown; 11 - } 1 + import type { CodeSampleObject, OpenAPIExtensions } from '../../extensions/openapi'; 2 + import type { Document as JSONSchemaDraft2020_12 } from '../../json-schema/draft-2020-12'; 12 3 13 4 /** 14 5 * This is the root object of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-document OpenAPI document}. 15 6 * 16 7 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 17 8 */ 18 - export interface OpenApiV3_1_X extends SpecificationExtensions { 9 + export interface Document extends OpenAPIExtensions { 19 10 /** 20 11 * An element to hold various schemas for the document. 21 12 */ ··· 139 130 * description: callback successfully processed 140 131 * ``` 141 132 */ 142 - export interface CallbackObject extends SpecificationExtensions { 133 + export interface CallbackObject extends OpenAPIExtensions { 143 134 /** 144 135 * A Path Item Object, or a reference to one, used to define a callback request and expected responses. A {@link https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/callback-example.yaml complete example} is available. 145 136 */ ··· 235 226 * read:pets: read your pets 236 227 * ``` 237 228 */ 238 - export interface ComponentsObject extends SpecificationExtensions { 229 + export interface ComponentsObject extends OpenAPIExtensions { 239 230 /** 240 231 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}. 241 232 */ ··· 290 281 * email: support@example.com 291 282 * ``` 292 283 */ 293 - export interface ContactObject extends SpecificationExtensions { 284 + export interface ContactObject extends OpenAPIExtensions { 294 285 /** 295 286 * The email address of the contact person/organization. This MUST be in the form of an email address. 296 287 */ ··· 431 422 * 432 423 * will map to `Dog` because of the definition in the `mapping` element. 433 424 */ 434 - export interface DiscriminatorObject extends SpecificationExtensions { 425 + export interface DiscriminatorObject extends OpenAPIExtensions { 435 426 /** 436 427 * An object to hold mappings between payload values and schema names or references. 437 428 */ ··· 483 474 * type: integer 484 475 * ``` 485 476 */ 486 - export interface EncodingObject extends SpecificationExtensions { 477 + export interface EncodingObject extends OpenAPIExtensions { 487 478 /** 488 479 * Determines whether the parameter value SHOULD allow reserved characters, as defined by {@link https://tools.ietf.org/html/rfc3986#section-2.2 RFC3986} `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType `contentType`} (implicit or explicit) SHALL be ignored. 489 480 */ ··· 579 570 * $ref: '#/components/examples/confirmation-success' 580 571 * ``` 581 572 */ 582 - export interface ExampleObject extends SpecificationExtensions { 573 + export interface ExampleObject extends OpenAPIExtensions { 583 574 /** 584 575 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 585 576 */ ··· 609 600 * url: https://example.com 610 601 * ``` 611 602 */ 612 - export interface ExternalDocumentationObject extends SpecificationExtensions { 603 + export interface ExternalDocumentationObject extends OpenAPIExtensions { 613 604 /** 614 605 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 615 606 */ ··· 657 648 * version: 1.0.1 658 649 * ``` 659 650 */ 660 - export interface InfoObject extends SpecificationExtensions { 651 + export interface InfoObject extends OpenAPIExtensions { 661 652 /** 662 653 * The contact information for the exposed API. 663 654 */ ··· 699 690 * identifier: Apache-2.0 700 691 * ``` 701 692 */ 702 - export interface LicenseObject extends SpecificationExtensions { 693 + export interface LicenseObject extends OpenAPIExtensions { 703 694 /** 704 695 * An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field. 705 696 */ ··· 861 852 * 862 853 * Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. 863 854 */ 864 - export interface LinkObject extends SpecificationExtensions { 855 + export interface LinkObject extends OpenAPIExtensions { 865 856 /** 866 857 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 867 858 */ ··· 921 912 * $ref: "#/components/examples/frog-example" 922 913 * ``` 923 914 */ 924 - export interface MediaTypeObject extends SpecificationExtensions { 915 + export interface MediaTypeObject extends OpenAPIExtensions { 925 916 /** 926 917 * A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. 927 918 */ ··· 963 954 * read:pets: read your pets 964 955 * ``` 965 956 */ 966 - export interface OAuthFlowObject extends SpecificationExtensions { 957 + export interface OAuthFlowObject extends OpenAPIExtensions { 967 958 /** 968 959 * **REQUIRED (`"implicit"`, `"authorizationCode"`)**. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. 969 960 */ ··· 987 978 * 988 979 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 989 980 */ 990 - export interface OAuthFlowsObject extends SpecificationExtensions { 981 + export interface OAuthFlowsObject extends OpenAPIExtensions { 991 982 /** 992 983 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 993 984 */ ··· 1055 1046 * - read:pets 1056 1047 * ``` 1057 1048 */ 1058 - export interface OperationObject extends SpecificationExtensions { 1049 + export interface OperationObject extends OpenAPIExtensions { 1059 1050 /** 1060 1051 * A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Object} that describes a request that may be initiated by the API provider and the expected responses. 1061 1052 */ ··· 1207 1198 * type: number 1208 1199 * ``` 1209 1200 */ 1210 - export interface ParameterObject extends SpecificationExtensions { 1201 + export interface ParameterObject extends OpenAPIExtensions { 1211 1202 /** 1212 1203 * Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision. 1213 1204 */ ··· 1310 1301 * style: simple 1311 1302 * ``` 1312 1303 */ 1313 - export interface PathItemObject extends SpecificationExtensions { 1304 + export interface PathItemObject extends OpenAPIExtensions { 1314 1305 /** 1315 1306 * Allows for a referenced definition of this path item. The referenced structure MUST be in the form of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object}. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}. 1316 1307 */ ··· 1410 1401 * $ref: '#/components/schemas/pet' 1411 1402 * ``` 1412 1403 */ 1413 - export interface PathsObject extends SpecificationExtensions { 1404 + export interface PathsObject extends OpenAPIExtensions { 1414 1405 /** 1415 1406 * A relative path to an individual endpoint. The field name MUST begin with a forward slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object `Server Object`}'s `url` field in order to construct the full URL. {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating Path templating} is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. 1416 1407 */ ··· 1515 1506 * type: string 1516 1507 * ``` 1517 1508 */ 1518 - export interface RequestBodyObject extends SpecificationExtensions { 1509 + export interface RequestBodyObject extends OpenAPIExtensions { 1519 1510 /** 1520 1511 * **REQUIRED**. The content of the request body. The key is a media type or {@link https://tools.ietf.org/html/rfc7231#appendix-D media type range} and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* 1521 1512 */ ··· 1591 1582 * description: object created 1592 1583 * ``` 1593 1584 */ 1594 - export interface ResponseObject extends SpecificationExtensions { 1585 + export interface ResponseObject extends OpenAPIExtensions { 1595 1586 /** 1596 1587 * A map containing descriptions of potential response payloads. The key is a media type or {@link https://datatracker.ietf.org/doc/html/rfc7231#appendix-D media type range} and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* 1597 1588 */ ··· 1639 1630 * $ref: '#/components/schemas/ErrorModel' 1640 1631 * ``` 1641 1632 */ 1642 - export interface ResponsesObject extends SpecificationExtensions { 1633 + export interface ResponsesObject extends OpenAPIExtensions { 1643 1634 /** 1644 1635 * Any {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#http-status-codes HTTP status code} can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. 1645 1636 */ ··· 1674 1665 * 1675 1666 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}, though as noted, additional properties MAY omit the `x-` prefix within this object. 1676 1667 */ 1677 - export type SchemaObject = JsonSchemaDraft2020_12 & SpecificationExtensions; 1668 + export type SchemaObject = JSONSchemaDraft2020_12 & OpenAPIExtensions; 1678 1669 1679 1670 /** 1680 1671 * Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsSecuritySchemes Security Schemes} under the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Components Object}. ··· 1761 1752 * read:pets: read your pets 1762 1753 * ``` 1763 1754 */ 1764 - export type SecuritySchemeObject = SpecificationExtensions & { 1755 + export type SecuritySchemeObject = OpenAPIExtensions & { 1765 1756 /** 1766 1757 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1767 1758 */ ··· 1834 1825 * description: Development server 1835 1826 * ``` 1836 1827 */ 1837 - export interface ServerObject extends SpecificationExtensions { 1828 + export interface ServerObject extends OpenAPIExtensions { 1838 1829 /** 1839 1830 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1840 1831 */ ··· 1854 1845 * 1855 1846 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 1856 1847 */ 1857 - export interface ServerVariableObject extends SpecificationExtensions { 1848 + export interface ServerVariableObject extends OpenAPIExtensions { 1858 1849 /** 1859 1850 * **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Object's} treatment of default values, because in those cases parameter values are optional. If the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverVariableEnum `enum`} is defined, the value MUST exist in the enum's values. 1860 1851 */ ··· 1880 1871 * description: Pets operations 1881 1872 * ``` 1882 1873 */ 1883 - export interface TagObject extends SpecificationExtensions { 1874 + export interface TagObject extends OpenAPIExtensions { 1884 1875 /** 1885 1876 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1886 1877 */ ··· 2087 2078 * </aliens> 2088 2079 * ``` 2089 2080 */ 2090 - export interface XMLObject extends SpecificationExtensions { 2081 + export interface XMLObject extends OpenAPIExtensions { 2091 2082 /** 2092 2083 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 2093 2084 */
+10 -9
packages/shared/src/openApi/__tests__/index.test.ts
··· 1 1 import { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV3, OpenAPIV3_1 } from '@hey-api/spec-types'; 2 3 3 4 import type { AnyConfig } from '../../config/shared'; 4 5 import { Context } from '../../ir/context'; 5 6 import { parseOpenApiSpec } from '..'; 6 - import { type OpenApiV3_0_X, parseV3_0_X } from '../3.0.x'; 7 - import { type OpenApiV3_1_X, parseV3_1_X } from '../3.1.x'; 7 + import { parseV3_0_X } from '../3.0.x'; 8 + import { parseV3_1_X } from '../3.1.x'; 8 9 9 10 vi.mock('../3.0.x', () => ({ 10 11 parseV3_0_X: vi.fn(), ··· 32 33 }); 33 34 34 35 it('handles OpenAPI 3.0.0', () => { 35 - const spec: OpenApiV3_0_X = { 36 + const spec: OpenAPIV3.Document = { 36 37 info: { 37 38 title: '', 38 39 version: '1', ··· 64 65 }); 65 66 66 67 it('handles OpenAPI 3.0.1', () => { 67 - const spec: OpenApiV3_0_X = { 68 + const spec: OpenAPIV3.Document = { 68 69 info: { 69 70 title: '', 70 71 version: '1', ··· 96 97 }); 97 98 98 99 it('handles OpenAPI 3.0.2', () => { 99 - const spec: OpenApiV3_0_X = { 100 + const spec: OpenAPIV3.Document = { 100 101 info: { 101 102 title: '', 102 103 version: '1', ··· 128 129 }); 129 130 130 131 it('handles OpenAPI 3.0.3', () => { 131 - const spec: OpenApiV3_0_X = { 132 + const spec: OpenAPIV3.Document = { 132 133 info: { 133 134 title: '', 134 135 version: '1', ··· 160 161 }); 161 162 162 163 it('handles OpenAPI 3.0.4', () => { 163 - const spec: OpenApiV3_0_X = { 164 + const spec: OpenAPIV3.Document = { 164 165 info: { 165 166 title: '', 166 167 version: '1', ··· 192 193 }); 193 194 194 195 it('handles OpenAPI 3.1.0', () => { 195 - const spec: OpenApiV3_1_X = { 196 + const spec: OpenAPIV3_1.Document = { 196 197 info: { 197 198 title: '', 198 199 version: '1', ··· 223 224 }); 224 225 225 226 it('handles OpenAPI 3.1.1', () => { 226 - const spec: OpenApiV3_1_X = { 227 + const spec: OpenAPIV3_1.Document = { 227 228 info: { 228 229 title: '', 229 230 version: '1',
-5
packages/shared/src/openApi/shared/types/index.ts
··· 1 - export type { 2 - CodeSampleObject, 3 - EnumExtensions, 4 - LinguistLanguages, 5 - } from './openapi-spec-extensions';
+9
packages/shared/src/openApi/shared/types/openapi-spec-extensions.ts packages/spec-types/src/extensions/openapi.ts
··· 56 56 */ 57 57 'x-enumNames'?: ReadonlyArray<string>; 58 58 } 59 + 60 + /** 61 + * OpenAPI Specification Extensions. 62 + * 63 + * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 64 + */ 65 + export interface OpenAPIExtensions { 66 + [extension: `x-${string}`]: unknown; 67 + }
+5 -5
packages/shared/src/openApi/shared/utils/filter.ts
··· 1 1 import type { Logger } from '@hey-api/codegen-core'; 2 + import type { OpenAPIV3_1 } from '@hey-api/spec-types'; 2 3 3 4 import type { Parser } from '../../../config/parser/types'; 4 5 import { createOperationKey } from '../../../ir/operation'; 5 - import type { PathItemObject, PathsObject } from '../../../openApi/3.1.x/types/spec'; 6 6 import type { OpenApi } from '../../../openApi/types'; 7 7 import type { ResourceMetadata } from '../graph/meta'; 8 8 import { httpMethods } from './operation'; ··· 109 109 }) => { 110 110 if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) { 111 111 for (const entry of Object.entries(spec.paths)) { 112 - const path = entry[0] as keyof PathsObject; 113 - const pathItem = entry[1] as PathItemObject; 112 + const path = entry[0] as keyof OpenAPIV3_1.PathsObject; 113 + const pathItem = entry[1] as OpenAPIV3_1.PathItemObject; 114 114 for (const method of httpMethods) { 115 115 const operation = pathItem[method]; 116 116 if (!operation) { ··· 161 161 }) => { 162 162 if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) { 163 163 for (const entry of Object.entries(spec.paths)) { 164 - const path = entry[0] as keyof PathsObject; 165 - const pathItem = entry[1] as PathItemObject; 164 + const path = entry[0] as keyof OpenAPIV3_1.PathsObject; 165 + const pathItem = entry[1] as OpenAPIV3_1.PathItemObject; 166 166 for (const method of httpMethods) { 167 167 const operation = pathItem[method]; 168 168 if (!operation) {
+19 -29
packages/shared/src/openApi/types.ts
··· 1 1 /* eslint-disable @typescript-eslint/no-namespace */ 2 - import type { OpenApiV2_0_X, OpenApiV2_0_XTypes } from './2.0.x'; 3 - import type { OpenApiV3_0_X, OpenApiV3_0_XTypes } from './3.0.x'; 4 - import type { OpenApiV3_1_X, OpenApiV3_1_XTypes } from './3.1.x'; 2 + import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@hey-api/spec-types'; 5 3 6 4 export namespace OpenApi { 7 - export type V2_0_X = OpenApiV2_0_X; 5 + export type V2_0_X = OpenAPIV2.Document; 8 6 9 - export type V3_0_X = OpenApiV3_0_X; 7 + export type V3_0_X = OpenAPIV3.Document; 10 8 11 - export type V3_1_X = OpenApiV3_1_X; 9 + export type V3_1_X = OpenAPIV3_1.Document; 12 10 } 13 11 14 12 export namespace OpenApiMetaObject { 15 - export type V2_0_X = OpenApiV2_0_XTypes['InfoObject']; 13 + export type V2_0_X = OpenAPIV2.InfoObject; 16 14 17 - export type V3_0_X = OpenApiV3_0_XTypes['InfoObject']; 15 + export type V3_0_X = OpenAPIV3.InfoObject; 18 16 19 - export type V3_1_X = OpenApiV3_1_XTypes['InfoObject']; 17 + export type V3_1_X = OpenAPIV3_1.InfoObject; 20 18 } 21 19 22 20 export namespace OpenApiOperationObject { 23 - export type V2_0_X = OpenApiV2_0_XTypes['OperationObject']; 21 + export type V2_0_X = OpenAPIV2.OperationObject; 24 22 25 - export type V3_0_X = OpenApiV3_0_XTypes['OperationObject']; 23 + export type V3_0_X = OpenAPIV3.OperationObject; 26 24 27 - export type V3_1_X = OpenApiV3_1_XTypes['OperationObject']; 25 + export type V3_1_X = OpenAPIV3_1.OperationObject; 28 26 } 29 27 30 28 export namespace OpenApiParameterObject { 31 - export type V3_0_X = 32 - | OpenApiV3_0_XTypes['ParameterObject'] 33 - | OpenApiV3_0_XTypes['ReferenceObject']; 29 + export type V3_0_X = OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject; 34 30 35 - export type V3_1_X = 36 - | OpenApiV3_1_XTypes['ParameterObject'] 37 - | OpenApiV3_1_XTypes['ReferenceObject']; 31 + export type V3_1_X = OpenAPIV3_1.ParameterObject | OpenAPIV3_1.ReferenceObject; 38 32 } 39 33 40 34 export namespace OpenApiRequestBodyObject { 41 - export type V3_0_X = 42 - | OpenApiV3_0_XTypes['RequestBodyObject'] 43 - | OpenApiV3_0_XTypes['ReferenceObject']; 35 + export type V3_0_X = OpenAPIV3.RequestBodyObject | OpenAPIV3.ReferenceObject; 44 36 45 - export type V3_1_X = 46 - | OpenApiV3_1_XTypes['RequestBodyObject'] 47 - | OpenApiV3_1_XTypes['ReferenceObject']; 37 + export type V3_1_X = OpenAPIV3_1.RequestBodyObject | OpenAPIV3_1.ReferenceObject; 48 38 } 49 39 50 40 export namespace OpenApiResponseObject { 51 - export type V3_0_X = OpenApiV3_0_XTypes['ResponseObject'] | OpenApiV3_0_XTypes['ReferenceObject']; 41 + export type V3_0_X = OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject; 52 42 53 - export type V3_1_X = OpenApiV3_1_XTypes['ResponseObject'] | OpenApiV3_1_XTypes['ReferenceObject']; 43 + export type V3_1_X = OpenAPIV3_1.ResponseObject | OpenAPIV3_1.ReferenceObject; 54 44 } 55 45 56 46 export namespace OpenApiSchemaObject { 57 - export type V2_0_X = OpenApiV2_0_XTypes['SchemaObject']; 47 + export type V2_0_X = OpenAPIV2.SchemaObject; 58 48 59 - export type V3_0_X = OpenApiV3_0_XTypes['SchemaObject']; 49 + export type V3_0_X = OpenAPIV3.SchemaObject; 60 50 61 - export type V3_1_X = OpenApiV3_1_XTypes['SchemaObject']; 51 + export type V3_1_X = OpenAPIV3_1.SchemaObject; 62 52 }
+21
packages/spec-types/LICENSE.md
··· 1 + MIT License 2 + 3 + Copyright (c) Hey API 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining a copy 6 + of this software and associated documentation files (the "Software"), to deal 7 + in the Software without restriction, including without limitation the rights 8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 + copies of the Software, and to permit persons to whom the Software is 10 + furnished to do so, subject to the following conditions: 11 + 12 + The above copyright notice and this permission notice shall be included in all 13 + copies or substantial portions of the Software. 14 + 15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 + SOFTWARE.
+27
packages/spec-types/README.md
··· 1 + <div align="center"> 2 + <h1><b>Spec Types</b></h1> 3 + </div> 4 + 5 + <p align="center"> 6 + <!-- <a href="https://www.devtrends.dev/trends?c=v1.kZIBIg"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fopenapi-ts?period=month&style=flat&view=value" alt="DevTrends badge for @hey-api/openapi-ts" /></a> --> 7 + <!-- <a href="https://www.devtrends.dev/trends?c=v1.kZIBIg&v=change"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fopenapi-ts?period=year&style=flat&view=change" alt="DevTrends badge for @hey-api/openapi-ts" /></a> --> 8 + <a href="https://github.com/hey-api/openapi-ts/actions?query=branch%3Amain"><img src="https://github.com/hey-api/openapi-ts/actions/workflows/ci.yml/badge.svg?event=push&branch=main" alt="CI status" /></a> 9 + <a href="https://github.com/hey-api/openapi-ts"><img src="https://img.shields.io/github/stars/hey-api/openapi-ts?style=flat&logo=github&label=GitHub&color=54C82D" alt="GitHub stars" /></a> 10 + <a href="https://github.com/hey-api/openapi-ts/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/hey-api/openapi-ts" alt="MIT License"></a> 11 + </p> 12 + 13 + <p align="center"> 14 + <!-- <a href="https://stackblitz.com/edit/hey-api-example?file=openapi-ts.config.ts,src%2Fclient%2Fschemas.gen.ts,src%2Fclient%2Fsdk.gen.ts,src%2Fclient%2Ftypes.gen.ts">Demo</a> 15 + <span>&nbsp;•&nbsp;</span> --> 16 + <!-- <a href="https://heyapi.dev">Manual</a> 17 + <span>&nbsp;•&nbsp;</span> --> 18 + <a href="https://github.com/hey-api/openapi-ts/issues">Issues</a> 19 + <span>&nbsp;•&nbsp;</span> 20 + <a href="https://heyapi.dev/openapi-ts/community/contributing">Contribute</a> 21 + </p> 22 + 23 + ## About 24 + 25 + TypeScript definitions for OpenAPI and JSON Schema specifications with complete inline documentation. 26 + 27 + Part of the Hey API ecosystem.
+59
packages/spec-types/package.json
··· 1 + { 2 + "name": "@hey-api/spec-types", 3 + "version": "0.0.0", 4 + "description": "📃 TypeScript definitions for OpenAPI and JSON Schema specifications with complete inline documentation.", 5 + "keywords": [ 6 + "definitions", 7 + "documentation", 8 + "json", 9 + "jsonschema", 10 + "openapi", 11 + "schema", 12 + "spec", 13 + "specification", 14 + "swagger", 15 + "types", 16 + "typescript" 17 + ], 18 + "homepage": "https://heyapi.dev/", 19 + "bugs": { 20 + "url": "https://github.com/hey-api/openapi-ts/issues" 21 + }, 22 + "license": "MIT", 23 + "author": { 24 + "name": "Hey API", 25 + "email": "lubos@heyapi.dev", 26 + "url": "https://heyapi.dev" 27 + }, 28 + "repository": { 29 + "type": "git", 30 + "url": "git+https://github.com/hey-api/openapi-ts.git" 31 + }, 32 + "funding": "https://github.com/sponsors/hey-api", 33 + "files": [ 34 + "dist", 35 + "LICENSE.md", 36 + "README.md" 37 + ], 38 + "type": "module", 39 + "sideEffects": false, 40 + "types": "./dist/index.d.ts", 41 + "exports": { 42 + ".": { 43 + "types": "./dist/index.d.ts" 44 + }, 45 + "./package.json": "./package.json" 46 + }, 47 + "scripts": { 48 + "build": "tsc --build", 49 + "dev": "tsc --build --watch", 50 + "prepublishOnly": "pnpm build", 51 + "typecheck": "tsgo --noEmit" 52 + }, 53 + "dependencies": { 54 + "@hey-api/types": "workspace:*" 55 + }, 56 + "devDependencies": { 57 + "typescript": "5.9.3" 58 + } 59 + }
+13
packages/spec-types/src/index.ts
··· 1 + export type { 2 + CodeSampleObject, 3 + EnumExtensions, 4 + LinguistLanguages, 5 + OpenAPIExtensions, 6 + } from './extensions/openapi'; 7 + export type * as JSONSchemaDraft4 from './json-schema/draft-4'; 8 + export type * as JSONSchemaDraft2020_12 from './json-schema/draft-2020-12'; 9 + export * as JSONSchema from './json-schema/union'; 10 + export * as OpenApi from './openapi/union'; 11 + export type * as OpenAPIV2 from './openapi/v2'; 12 + export type * as OpenAPIV3 from './openapi/v3'; 13 + export type * as OpenAPIV3_1 from './openapi/v3-1';
+1
packages/spec-types/src/json-schema/draft-2020-12/index.ts
··· 1 + export type * from './spec';
+1
packages/spec-types/src/json-schema/draft-4/index.ts
··· 1 + export type * from './spec';
+7
packages/spec-types/src/json-schema/union.ts
··· 1 + import type { Document as JSONSchemaDraft4 } from './draft-4'; 2 + import type { Document as JSONSchemaDraft2020_12 } from './draft-2020-12'; 3 + 4 + /** 5 + * Union of all supported JSON Schema document versions. 6 + */ 7 + export type Document = JSONSchemaDraft4 | JSONSchemaDraft2020_12;
+8
packages/spec-types/src/openapi/union.ts
··· 1 + import type { Document as OpenAPIV2 } from './v2'; 2 + import type { Document as OpenAPIV3 } from './v3'; 3 + import type { Document as OpenAPIV3_1 } from './v3-1'; 4 + 5 + /** 6 + * Union of all supported OpenAPI document versions. 7 + */ 8 + export type Document = OpenAPIV2 | OpenAPIV3 | OpenAPIV3_1;
+2
packages/spec-types/src/openapi/v2/index.ts
··· 1 + export type { OpenAPIV2NullableExtensions as NullableExtensions } from './extensions'; 2 + export type * from './spec';
+2
packages/spec-types/src/openapi/v3-1/index.ts
··· 1 + export type { OpenAPIV3_1SchemaExtensions as Extensions } from './extensions'; 2 + export type * from './spec';
+1
packages/spec-types/src/openapi/v3/index.ts
··· 1 + export type * from './spec';
+10
packages/spec-types/tsconfig.json
··· 1 + { 2 + "extends": "../../tsconfig.base.json", 3 + "compilerOptions": { 4 + "composite": true, 5 + "emitDeclarationOnly": true, 6 + "outDir": "dist", 7 + "rootDir": "src" 8 + }, 9 + "include": ["src"] 10 + }
+1
packages/types/package.json
··· 15 15 "dist" 16 16 ], 17 17 "type": "module", 18 + "sideEffects": false, 18 19 "types": "./dist/index.d.ts", 19 20 "exports": { 20 21 ".": {
+34 -241
pnpm-lock.yaml
··· 1312 1312 version: 1.8.0 1313 1313 nuxt: 1314 1314 specifier: '>=3.0.0' 1315 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.4)(encoding@0.1.13)(eslint@9.39.2(jiti@2.6.1))(ioredis@5.9.2)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@3.29.5)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue-tsc@3.2.4(typescript@5.9.3)) 1315 + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.2)(encoding@0.1.13)(eslint@9.39.2(jiti@2.6.1))(ioredis@5.7.0)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@3.29.5)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue-tsc@3.2.4(typescript@5.9.3)) 1316 1316 vue: 1317 1317 specifier: '>=3.5.13' 1318 1318 version: 3.5.13(typescript@5.9.3) ··· 1344 1344 '@hey-api/shared': 1345 1345 specifier: workspace:* 1346 1346 version: link:../shared 1347 + '@hey-api/spec-types': 1348 + specifier: workspace:* 1349 + version: link:../spec-types 1347 1350 '@hey-api/types': 1348 1351 specifier: workspace:* 1349 1352 version: link:../types ··· 1396 1399 '@hey-api/shared': 1397 1400 specifier: workspace:* 1398 1401 version: link:../shared 1402 + '@hey-api/spec-types': 1403 + specifier: workspace:* 1404 + version: link:../spec-types 1399 1405 '@hey-api/types': 1400 1406 specifier: workspace:* 1401 1407 version: link:../types ··· 1444 1450 version: 1.14.3 1445 1451 nuxt: 1446 1452 specifier: 3.14.1592 1447 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.2)(encoding@0.1.13)(eslint@9.39.1(jiti@2.6.1))(ioredis@5.7.0)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@4.56.0)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1))(vue-tsc@3.2.4(typescript@5.9.3)) 1453 + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.4)(encoding@0.1.13)(eslint@9.39.1(jiti@2.6.1))(ioredis@5.9.2)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@4.56.0)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue-tsc@3.2.4(typescript@5.9.3)) 1448 1454 ofetch: 1449 1455 specifier: 1.5.1 1450 1456 version: 1.5.1 ··· 1658 1664 '@hey-api/json-schema-ref-parser': 1659 1665 specifier: workspace:* 1660 1666 version: link:../json-schema-ref-parser 1667 + '@hey-api/spec-types': 1668 + specifier: workspace:* 1669 + version: link:../spec-types 1661 1670 '@hey-api/types': 1662 1671 specifier: workspace:* 1663 1672 version: link:../types ··· 1692 1701 yaml: 1693 1702 specifier: 2.8.2 1694 1703 version: 2.8.2 1704 + 1705 + packages/spec-types: 1706 + dependencies: 1707 + '@hey-api/types': 1708 + specifier: workspace:* 1709 + version: link:../types 1710 + devDependencies: 1711 + typescript: 1712 + specifier: 5.9.3 1713 + version: 5.9.3 1695 1714 1696 1715 packages/types: 1697 1716 devDependencies: ··· 19804 19823 19805 19824 '@nuxt/devalue@2.0.2': {} 19806 19825 19807 - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1))': 19808 - dependencies: 19809 - '@nuxt/kit': 3.21.0(magicast@0.3.5) 19810 - '@nuxt/schema': 3.16.2 19811 - execa: 7.2.0 19812 - vite: 5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1) 19813 - transitivePeerDependencies: 19814 - - magicast 19815 - 19816 19826 '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))': 19817 19827 dependencies: 19818 19828 '@nuxt/kit': 3.21.0(magicast@0.3.5) ··· 19900 19910 vite: 7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) 19901 19911 vite-plugin-inspect: 0.8.9(@nuxt/kit@3.21.0(magicast@0.3.5))(rollup@3.29.5)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)) 19902 19912 vite-plugin-vue-inspector: 5.3.2(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)) 19903 - which: 3.0.1 19904 - ws: 8.18.3 19905 - transitivePeerDependencies: 19906 - - bufferutil 19907 - - rollup 19908 - - supports-color 19909 - - utf-8-validate 19910 - - vue 19911 - 19912 - '@nuxt/devtools@1.7.0(rollup@4.56.0)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1))(vue@3.5.25(typescript@5.9.3))': 19913 - dependencies: 19914 - '@antfu/utils': 0.7.10 19915 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)) 19916 - '@nuxt/devtools-wizard': 1.7.0 19917 - '@nuxt/kit': 3.21.0(magicast@0.3.5) 19918 - '@vue/devtools-core': 7.6.8(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1))(vue@3.5.25(typescript@5.9.3)) 19919 - '@vue/devtools-kit': 7.6.8 19920 - birpc: 0.2.19 19921 - consola: 3.4.2 19922 - cronstrue: 2.59.0 19923 - destr: 2.0.5 19924 - error-stack-parser-es: 0.1.5 19925 - execa: 7.2.0 19926 - fast-npm-meta: 0.2.2 19927 - flatted: 3.3.3 19928 - get-port-please: 3.2.0 19929 - hookable: 5.5.3 19930 - image-meta: 0.2.1 19931 - is-installed-globally: 1.0.0 19932 - launch-editor: 2.11.1 19933 - local-pkg: 0.5.1 19934 - magicast: 0.3.5 19935 - nypm: 0.4.1 19936 - ohash: 1.1.6 19937 - pathe: 1.1.2 19938 - perfect-debounce: 1.0.0 19939 - pkg-types: 1.3.1 19940 - rc9: 2.1.2 19941 - scule: 1.3.0 19942 - semver: 7.7.3 19943 - simple-git: 3.28.0 19944 - sirv: 3.0.2 19945 - tinyglobby: 0.2.15 19946 - unimport: 3.14.6(rollup@4.56.0) 19947 - vite: 5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1) 19948 - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.21.0(magicast@0.3.5))(rollup@4.56.0)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)) 19949 - vite-plugin-vue-inspector: 5.3.2(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)) 19950 19913 which: 3.0.1 19951 19914 ws: 8.18.3 19952 19915 transitivePeerDependencies: ··· 23659 23622 dependencies: 23660 23623 '@vue/devtools-kit': 8.0.5 23661 23624 23662 - '@vue/devtools-core@7.6.8(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1))(vue@3.5.25(typescript@5.9.3))': 23663 - dependencies: 23664 - '@vue/devtools-kit': 7.7.7 23665 - '@vue/devtools-shared': 7.7.7 23666 - mitt: 3.0.1 23667 - nanoid: 5.1.5 23668 - pathe: 1.1.2 23669 - vite-hot-client: 0.2.4(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)) 23670 - vue: 3.5.25(typescript@5.9.3) 23671 - transitivePeerDependencies: 23672 - - vite 23673 - 23674 23625 '@vue/devtools-core@7.6.8(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))': 23675 23626 dependencies: 23676 23627 '@vue/devtools-kit': 7.7.7 ··· 25868 25819 eslint: 9.17.0(jiti@2.6.1) 25869 25820 eslint-import-resolver-node: 0.3.9 25870 25821 eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 25871 - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) 25822 + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 25872 25823 eslint-plugin-jsx-a11y: 6.10.2(eslint@9.17.0(jiti@2.6.1)) 25873 25824 eslint-plugin-react: 7.37.5(eslint@9.17.0(jiti@2.6.1)) 25874 25825 eslint-plugin-react-hooks: 5.2.0(eslint@9.17.0(jiti@2.6.1)) ··· 25898 25849 tinyglobby: 0.2.15 25899 25850 unrs-resolver: 1.11.1 25900 25851 optionalDependencies: 25901 - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) 25852 + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 25902 25853 transitivePeerDependencies: 25903 25854 - supports-color 25904 25855 ··· 25913 25864 transitivePeerDependencies: 25914 25865 - supports-color 25915 25866 25916 - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)): 25867 + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): 25917 25868 dependencies: 25918 25869 '@rtsao/scc': 1.1.0 25919 25870 array-includes: 3.1.9 ··· 29006 28957 29007 28958 nuxi@3.28.0: {} 29008 28959 29009 - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.2)(encoding@0.1.13)(eslint@9.39.1(jiti@2.6.1))(ioredis@5.7.0)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@4.56.0)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1))(vue-tsc@3.2.4(typescript@5.9.3)): 28960 + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.2)(encoding@0.1.13)(eslint@9.39.2(jiti@2.6.1))(ioredis@5.7.0)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@3.29.5)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue-tsc@3.2.4(typescript@5.9.3)): 29010 28961 dependencies: 29011 28962 '@nuxt/devalue': 2.0.2 29012 - '@nuxt/devtools': 1.7.0(rollup@4.56.0)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1))(vue@3.5.25(typescript@5.9.3)) 29013 - '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.56.0) 29014 - '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.56.0) 28963 + '@nuxt/devtools': 1.7.0(rollup@3.29.5)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3)) 28964 + '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@3.29.5) 28965 + '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@3.29.5) 29015 28966 '@nuxt/telemetry': 2.6.6(magicast@0.3.5) 29016 - '@nuxt/vite-builder': 3.14.1592(@types/node@25.2.1)(eslint@9.39.1(jiti@2.6.1))(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@4.56.0)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vue-tsc@3.2.4(typescript@5.9.3))(vue@3.5.25(typescript@5.9.3)) 28967 + '@nuxt/vite-builder': 3.14.1592(@types/node@25.2.1)(eslint@9.39.2(jiti@2.6.1))(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@3.29.5)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vue-tsc@3.2.4(typescript@5.9.3))(vue@3.5.25(typescript@5.9.3)) 29017 28968 '@unhead/dom': 1.11.20 29018 28969 '@unhead/shared': 1.11.20 29019 28970 '@unhead/ssr': 1.11.20 ··· 29036 28987 h3: 1.15.4 29037 28988 hookable: 5.5.3 29038 28989 ignore: 6.0.2 29039 - impound: 0.2.2(rollup@4.56.0) 28990 + impound: 0.2.2(rollup@3.29.5) 29040 28991 jiti: 2.6.1 29041 28992 klona: 2.0.6 29042 28993 knitwork: 1.3.0 ··· 29063 29014 unctx: 2.4.1 29064 29015 unenv: 1.10.0 29065 29016 unhead: 1.11.20 29066 - unimport: 3.14.6(rollup@4.56.0) 29017 + unimport: 3.14.6(rollup@3.29.5) 29067 29018 unplugin: 1.16.1 29068 - unplugin-vue-router: 0.10.9(rollup@4.56.0)(vue-router@4.5.0(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3)) 29019 + unplugin-vue-router: 0.10.9(rollup@3.29.5)(vue-router@4.5.0(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3)) 29069 29020 unstorage: 1.17.0(@netlify/blobs@9.1.2)(db0@0.3.2)(ioredis@5.7.0) 29070 29021 untyped: 1.5.2 29071 29022 vue: 3.5.25(typescript@5.9.3) 29072 29023 vue-bundle-renderer: 2.1.2 29073 29024 vue-devtools-stub: 0.1.0 29074 - vue-router: 4.5.0(vue@3.5.25(typescript@5.9.3)) 29025 + vue-router: 4.5.0(vue@3.5.13(typescript@5.9.3)) 29075 29026 optionalDependencies: 29076 29027 '@parcel/watcher': 2.5.1 29077 29028 '@types/node': 25.2.1 ··· 29248 29199 - vue-tsc 29249 29200 - xml2js 29250 29201 29251 - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.4)(encoding@0.1.13)(eslint@9.39.2(jiti@2.6.1))(ioredis@5.9.2)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@3.29.5)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue-tsc@3.2.4(typescript@5.9.3)): 29252 - dependencies: 29253 - '@nuxt/devalue': 2.0.2 29254 - '@nuxt/devtools': 1.7.0(rollup@3.29.5)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3)) 29255 - '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@3.29.5) 29256 - '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@3.29.5) 29257 - '@nuxt/telemetry': 2.6.6(magicast@0.3.5) 29258 - '@nuxt/vite-builder': 3.14.1592(@types/node@25.2.1)(eslint@9.39.2(jiti@2.6.1))(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@3.29.5)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vue-tsc@3.2.4(typescript@5.9.3))(vue@3.5.25(typescript@5.9.3)) 29259 - '@unhead/dom': 1.11.20 29260 - '@unhead/shared': 1.11.20 29261 - '@unhead/ssr': 1.11.20 29262 - '@unhead/vue': 1.11.20(vue@3.5.25(typescript@5.9.3)) 29263 - '@vue/shared': 3.5.25 29264 - acorn: 8.14.0 29265 - c12: 2.0.1(magicast@0.3.5) 29266 - chokidar: 4.0.3 29267 - compatx: 0.1.8 29268 - consola: 3.4.2 29269 - cookie-es: 1.2.2 29270 - defu: 6.1.4 29271 - destr: 2.0.5 29272 - devalue: 5.3.2 29273 - errx: 0.1.0 29274 - esbuild: 0.24.2 29275 - escape-string-regexp: 5.0.0 29276 - estree-walker: 3.0.3 29277 - globby: 14.1.0 29278 - h3: 1.15.4 29279 - hookable: 5.5.3 29280 - ignore: 6.0.2 29281 - impound: 0.2.2(rollup@3.29.5) 29282 - jiti: 2.6.1 29283 - klona: 2.0.6 29284 - knitwork: 1.3.0 29285 - magic-string: 0.30.21 29286 - mlly: 1.8.0 29287 - nanotar: 0.1.1 29288 - nitropack: 2.12.4(@netlify/blobs@9.1.2)(encoding@0.1.13)(rolldown@1.0.0-rc.9) 29289 - nuxi: 3.28.0 29290 - nypm: 0.3.12 29291 - ofetch: 1.5.1 29292 - ohash: 1.1.6 29293 - pathe: 1.1.2 29294 - perfect-debounce: 1.0.0 29295 - pkg-types: 1.3.1 29296 - radix3: 1.1.2 29297 - scule: 1.3.0 29298 - semver: 7.7.3 29299 - std-env: 3.10.0 29300 - strip-literal: 2.1.1 29301 - tinyglobby: 0.2.10 29302 - ufo: 1.6.1 29303 - ultrahtml: 1.6.0 29304 - uncrypto: 0.1.3 29305 - unctx: 2.4.1 29306 - unenv: 1.10.0 29307 - unhead: 1.11.20 29308 - unimport: 3.14.6(rollup@3.29.5) 29309 - unplugin: 1.16.1 29310 - unplugin-vue-router: 0.10.9(rollup@3.29.5)(vue-router@4.5.0(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3)) 29311 - unstorage: 1.17.0(@netlify/blobs@9.1.2)(db0@0.3.4)(ioredis@5.9.2) 29312 - untyped: 1.5.2 29313 - vue: 3.5.25(typescript@5.9.3) 29314 - vue-bundle-renderer: 2.1.2 29315 - vue-devtools-stub: 0.1.0 29316 - vue-router: 4.5.0(vue@3.5.25(typescript@5.9.3)) 29317 - optionalDependencies: 29318 - '@parcel/watcher': 2.5.1 29319 - '@types/node': 25.2.1 29320 - transitivePeerDependencies: 29321 - - '@azure/app-configuration' 29322 - - '@azure/cosmos' 29323 - - '@azure/data-tables' 29324 - - '@azure/identity' 29325 - - '@azure/keyvault-secrets' 29326 - - '@azure/storage-blob' 29327 - - '@biomejs/biome' 29328 - - '@capacitor/preferences' 29329 - - '@deno/kv' 29330 - - '@electric-sql/pglite' 29331 - - '@libsql/client' 29332 - - '@netlify/blobs' 29333 - - '@planetscale/database' 29334 - - '@upstash/redis' 29335 - - '@vercel/blob' 29336 - - '@vercel/functions' 29337 - - '@vercel/kv' 29338 - - aws4fetch 29339 - - better-sqlite3 29340 - - bufferutil 29341 - - db0 29342 - - drizzle-orm 29343 - - encoding 29344 - - eslint 29345 - - idb-keyval 29346 - - ioredis 29347 - - less 29348 - - lightningcss 29349 - - magicast 29350 - - meow 29351 - - mysql2 29352 - - optionator 29353 - - rolldown 29354 - - rollup 29355 - - sass 29356 - - sass-embedded 29357 - - sqlite3 29358 - - stylelint 29359 - - stylus 29360 - - sugarss 29361 - - supports-color 29362 - - terser 29363 - - typescript 29364 - - uploadthing 29365 - - utf-8-validate 29366 - - vite 29367 - - vls 29368 - - vti 29369 - - vue-tsc 29370 - - xml2js 29371 - 29372 29202 nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@25.2.1)(db0@0.3.4)(encoding@0.1.13)(eslint@9.39.2(jiti@2.6.1))(ioredis@5.9.2)(less@4.4.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-rc.9)(rollup@4.56.0)(sass@1.97.1)(terser@5.44.1)(typescript@5.9.3)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue-tsc@3.2.4(typescript@5.9.3)): 29373 29203 dependencies: 29374 29204 '@nuxt/devalue': 2.0.2 ··· 32727 32557 unplugin: 2.0.0-beta.1 32728 32558 yaml: 2.8.2 32729 32559 optionalDependencies: 32730 - vue-router: 4.5.0(vue@3.5.25(typescript@5.9.3)) 32560 + vue-router: 4.5.0(vue@3.5.13(typescript@5.9.3)) 32731 32561 transitivePeerDependencies: 32732 32562 - rollup 32733 32563 - vue ··· 33037 32867 vite: 7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) 33038 32868 vite-hot-client: 2.1.0(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)) 33039 32869 33040 - vite-hot-client@0.2.4(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)): 33041 - dependencies: 33042 - vite: 5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1) 33043 - 33044 32870 vite-hot-client@0.2.4(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)): 33045 32871 dependencies: 33046 32872 vite: 7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) ··· 33172 32998 - rollup 33173 32999 - supports-color 33174 33000 33175 - vite-plugin-inspect@0.8.9(@nuxt/kit@3.21.0(magicast@0.3.5))(rollup@4.56.0)(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)): 33176 - dependencies: 33177 - '@antfu/utils': 0.7.10 33178 - '@rollup/pluginutils': 5.2.0(rollup@4.56.0) 33179 - debug: 4.4.3 33180 - error-stack-parser-es: 0.1.5 33181 - fs-extra: 11.3.1 33182 - open: 10.2.0 33183 - perfect-debounce: 1.0.0 33184 - picocolors: 1.1.1 33185 - sirv: 3.0.2 33186 - vite: 5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1) 33187 - optionalDependencies: 33188 - '@nuxt/kit': 3.21.0(magicast@0.3.5) 33189 - transitivePeerDependencies: 33190 - - rollup 33191 - - supports-color 33192 - 33193 33001 vite-plugin-inspect@0.8.9(@nuxt/kit@3.21.0(magicast@0.3.5))(rollup@4.56.0)(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)): 33194 33002 dependencies: 33195 33003 '@antfu/utils': 0.7.10 ··· 33254 33062 - '@nuxt/kit' 33255 33063 - supports-color 33256 33064 - vue 33257 - 33258 - vite-plugin-vue-inspector@5.3.2(vite@5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)): 33259 - dependencies: 33260 - '@babel/core': 7.28.3 33261 - '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) 33262 - '@babel/plugin-syntax-import-attributes': 7.27.1(@babel/core@7.28.3) 33263 - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.28.3) 33264 - '@babel/plugin-transform-typescript': 7.28.0(@babel/core@7.28.3) 33265 - '@vue/babel-plugin-jsx': 1.5.0(@babel/core@7.28.3) 33266 - '@vue/compiler-dom': 3.5.25 33267 - kolorist: 1.8.0 33268 - magic-string: 0.30.21 33269 - vite: 5.4.19(@types/node@25.2.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1) 33270 - transitivePeerDependencies: 33271 - - supports-color 33272 33065 33273 33066 vite-plugin-vue-inspector@5.3.2(vite@7.3.1(@types/node@24.10.10)(jiti@2.6.1)(less@4.4.2)(sass@1.97.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)): 33274 33067 dependencies: