···11-import type { FeatureToggle, IR, LinguistLanguages } from '@hey-api/shared';
11+import type { FeatureToggle, IR } from '@hey-api/shared';
22+import type { LinguistLanguages } from '@hey-api/spec-types';
23import type { MaybeFunc } from '@hey-api/types';
3445import type { CallArgs, DollarPyDsl, ExampleOptions } from '../../../../py-dsl';
···11-import type { FeatureToggle, IR, LinguistLanguages } from '@hey-api/shared';
11+import type { FeatureToggle, IR } from '@hey-api/shared';
22+import type { LinguistLanguages } from '@hey-api/spec-types';
23import type { MaybeFunc } from '@hey-api/types';
3445import type { CallArgs, DollarTsDsl, ExampleOptions } from '../../../../ts-dsl';
···7979} from './ir/types';
8080export { addItemsToSchema } from './ir/utils';
8181export { parseOpenApiSpec } from './openApi';
8282-export type { OpenApiV2_0_X, OpenApiV2_0_XTypes } from './openApi/2.0.x';
8382export { parseV2_0_X } from './openApi/2.0.x';
8484-export type { OpenApiV3_0_X, OpenApiV3_0_XTypes } from './openApi/3.0.x';
8583export { parseV3_0_X } from './openApi/3.0.x';
8686-export type { OpenApiV3_1_X, OpenApiV3_1_XTypes } from './openApi/3.1.x';
8784export { parseV3_1_X } from './openApi/3.1.x';
8885export type { OperationsStrategy } from './openApi/shared/locations';
8986export type { OperationPathStrategy, OperationStructureStrategy } from './openApi/shared/locations';
9087export { OperationPath, OperationStrategy } from './openApi/shared/locations';
9191-export type {
9292- CodeSampleObject,
9393- EnumExtensions,
9494- LinguistLanguages,
9595-} from './openApi/shared/types/openapi-spec-extensions';
9688export { buildGraph } from './openApi/shared/utils/graph';
9789export { patchOpenApiSpec } from './openApi/shared/utils/patch';
9890export type {
+1-1
packages/shared/src/ir/intents.ts
···11+import type { CodeSampleObject } from '@hey-api/spec-types';
12import type { MaybePromise } from '@hey-api/types';
2333-import type { CodeSampleObject } from '..//openApi/shared/types';
44import type { IR } from './types';
5566export interface ExampleIntent {
+10-24
packages/shared/src/ir/types.ts
···11/* eslint-disable @typescript-eslint/no-namespace */
22import type { Symbol } from '@hey-api/codegen-core';
33+import type { JSONSchemaDraft2020_12, OpenAPIExtensions, OpenAPIV3_1 } from '@hey-api/spec-types';
3444-import type { JsonSchemaDraft2020_12 } from '../openApi/3.1.x/types/json-schema-draft-2020-12';
55-import type {
66- ReferenceObject as IRReferenceObject,
77- SecuritySchemeObject,
88- ServerObject,
99-} from '../openApi/3.1.x/types/spec';
105import type { IRMediaType } from './mediaType';
1111-1212-/**
1313- * OpenAPI Specification Extensions.
1414- *
1515- * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
1616- */
1717-export interface SpecificationExtensions {
1818- [extension: `x-${string}`]: unknown;
1919-}
206217interface IRBodyObject {
228 mediaType: string;
···3622 schemas?: Record<string, IRSchemaObject>;
3723}
38243939-export interface IROperationObject extends SpecificationExtensions {
2525+export interface IROperationObject extends OpenAPIExtensions {
4026 body?: IRBodyObject;
4127 deprecated?: boolean;
4228 description?: string;
···6046}
61476248export interface IRParameterObject
6363- extends Pick<JsonSchemaDraft2020_12, 'deprecated' | 'description'>, SpecificationExtensions {
4949+ extends Pick<JSONSchemaDraft2020_12.Document, 'deprecated' | 'description'>, OpenAPIExtensions {
6450 /**
6551 * 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.
6652 */
···10288 trace?: IROperationObject;
10389}
10490105105-interface IRRequestBodyObject extends Pick<JsonSchemaDraft2020_12, 'description'> {
9191+interface IRRequestBodyObject extends Pick<JSONSchemaDraft2020_12.Document, 'description'> {
10692 required?: boolean;
10793 schema: IRSchemaObject;
10894}
···127113export interface IRSchemaObject
128114 extends
129115 Pick<
130130- JsonSchemaDraft2020_12,
116116+ JSONSchemaDraft2020_12.Document,
131117 | '$ref'
132118 | 'const'
133119 | 'default'
···146132 | 'title'
147133 | 'example'
148134 >,
149149- SpecificationExtensions {
135135+ OpenAPIExtensions {
150136 /**
151137 * If the schema is intended to be used as an object property, it can be
152138 * marked as read-only or write-only. This value controls whether the schema
···162148 /**
163149 * Any string value is accepted as `format`.
164150 */
165165- format?: JsonSchemaDraft2020_12['format'] | 'binary' | 'integer';
151151+ format?: JSONSchemaDraft2020_12.Document['format'] | 'binary' | 'integer';
166152 /**
167153 * If schema resolves into multiple items instead of a simple `type`, they
168154 * will be included in `items` array.
···219205 | 'void';
220206}
221207222222-type IRSecurityObject = SecuritySchemeObject;
208208+type IRSecurityObject = OpenAPIV3_1.SecuritySchemeObject;
223209224210// 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
225225-export interface IRServerObject extends ServerObject {}
211211+export interface IRServerObject extends OpenAPIV3_1.ServerObject {}
226212227213type IRWebhookObject = IRPathItemObject;
228214···242228 export type ParametersObject = IRParametersObject;
243229 export type PathItemObject = IRPathItemObject;
244230 export type PathsObject = IRPathsObject;
245245- export type ReferenceObject = IRReferenceObject;
231231+ export type ReferenceObject = OpenAPIV3_1.ReferenceObject;
246232 export type RequestBodyObject = IRRequestBodyObject;
247233 export type ResponseObject = IRResponseObject;
248234 export type ResponsesObject = IRResponsesObject;
-9
packages/shared/src/openApi/2.0.x/index.ts
···11export { parseV2_0_X } from './parser';
22-export type { OpenApiV2_0_X } from './types/spec';
33-44-import type { InfoObject, OperationObject, SchemaObject } from './types/spec';
55-66-export interface OpenApiV2_0_XTypes {
77- InfoObject: InfoObject;
88- OperationObject: OperationObject;
99- SchemaObject: SchemaObject;
1010-}
···11import type { AnyString } from '@hey-api/types';
2233-import type { EnumExtensions } from '../../../openApi/shared/types';
33+import type { EnumExtensions } from '../../extensions/openapi';
4455-export interface JsonSchemaDraft4 extends EnumExtensions {
55+export interface Document extends EnumExtensions {
66 /**
77 * 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}.
88 *
···143143 uniqueItems?: boolean;
144144}
145145146146-type JsonSchemaFormats = 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uri' | AnyString;
146146+export type JsonSchemaFormats =
147147+ | 'date-time'
148148+ | 'email'
149149+ | 'hostname'
150150+ | 'ipv4'
151151+ | 'ipv6'
152152+ | 'uri'
153153+ | AnyString;
147154148148-type JsonSchemaTypes = 'array' | 'boolean' | 'integer' | 'number' | 'object' | 'string';
155155+export type JsonSchemaTypes = 'array' | 'boolean' | 'integer' | 'number' | 'object' | 'string';
···11-export interface OpenApiV2_0_X_Nullable_Extensions {
11+export interface OpenAPIV2NullableExtensions {
22 /**
33 * OpenAPI 2.0 does not natively support null as a type, but you can use
44 * `x-nullable` to polyfill this functionality.
···11-import type { CodeSampleObject, EnumExtensions } from '../../../openApi/shared/types';
22-import type { JsonSchemaDraft4 } from './json-schema-draft-4';
33-import type { OpenApiV2_0_X_Nullable_Extensions } from './openapi-spec-extensions';
11+import type { CodeSampleObject, EnumExtensions } from '../../extensions/openapi';
22+import type { Document as JSONSchemaDraft4 } from '../../json-schema/draft-4/spec';
33+import type { OpenAPIV2NullableExtensions } from './extensions';
4455/**
66 * 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.
77 */
88-export interface OpenApiV2_0_X {
88+export interface Document {
99 /**
1010 * 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.
1111 */
···192192 * type: integer
193193 * ```
194194 */
195195-export interface HeaderObject extends EnumExtensions, OpenApiV2_0_X_Nullable_Extensions {
195195+export interface HeaderObject extends EnumExtensions, OpenAPIV2NullableExtensions {
196196 /**
197197 * 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.
198198 */
···378378 * maximum: 63
379379 * ```
380380 */
381381-export interface ItemsObject extends EnumExtensions, OpenApiV2_0_X_Nullable_Extensions {
381381+export interface ItemsObject extends EnumExtensions, OpenAPIV2NullableExtensions {
382382 /**
383383 * 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.
384384 */
···684684 * ```
685685 */
686686export type ParameterObject = EnumExtensions &
687687- OpenApiV2_0_X_Nullable_Extensions & {
687687+ OpenAPIV2NullableExtensions & {
688688 /**
689689 * 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.
690690 */
···13061306 * - packSize
13071307 * ```
13081308 */
13091309-export interface SchemaObject extends JsonSchemaDraft4, OpenApiV2_0_X_Nullable_Extensions {
13091309+export interface SchemaObject extends JSONSchemaDraft4, OpenAPIV2NullableExtensions {
13101310 /**
13111311 * 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.
13121312 */
···11-import type { AnyString } from '@hey-api/types';
22-33-import type { CodeSampleObject, EnumExtensions } from '../../../openApi/shared/types';
44-55-/**
66- * OpenAPI Specification Extensions.
77- *
88- * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}.
99- */
1010-export interface SpecificationExtensions {
1111- [extension: `x-${string}`]: unknown;
1212-}
11+import type { CodeSampleObject, EnumExtensions, OpenAPIExtensions } from '../../extensions/openapi';
132143/**
154 * 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}.
165 *
176 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}.
187 */
1919-export interface OpenApiV3_0_X extends SpecificationExtensions {
88+export interface Document extends OpenAPIExtensions {
209 /**
2110 * An element to hold various Objects for the OpenAPI Description.
2211 */
···5847 *
5948 * TODO: examples
6049 */
6161-export interface CallbackObject extends SpecificationExtensions {
5050+export interface CallbackObject extends OpenAPIExtensions {
6251 /**
6352 * 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.
6453 */
···7463 *
7564 * TODO: examples
7665 */
7777-export interface ComponentsObject extends SpecificationExtensions {
6666+export interface ComponentsObject extends OpenAPIExtensions {
7867 /**
7968 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#callback-object Callback Objects}.
8069 */
···124113 * email: support@example.com
125114 * ```
126115 */
127127-export interface ContactObject extends SpecificationExtensions {
116116+export interface ContactObject extends OpenAPIExtensions {
128117 /**
129118 * The email address of the contact person/organization. This MUST be in the form of an email address.
130119 */
···171160 * TODO: default values examples
172161 * TODO: examples
173162 */
174174-export interface EncodingObject extends SpecificationExtensions {
163163+export interface EncodingObject extends OpenAPIExtensions {
175164 /**
176165 * 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`.
177166 */
···212201 *
213202 * TODO: examples
214203 */
215215-export interface ExampleObject extends SpecificationExtensions {
204204+export interface ExampleObject extends OpenAPIExtensions {
216205 /**
217206 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
218207 */
···243232 * url: https://example.com
244233 * ```
245234 */
246246-export interface ExternalDocumentationObject extends SpecificationExtensions {
235235+export interface ExternalDocumentationObject extends OpenAPIExtensions {
247236 /**
248237 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
249238 */
···287276 * version: 1.0.1
288277 * ```
289278 */
290290-export interface InfoObject extends SpecificationExtensions {
279279+export interface InfoObject extends OpenAPIExtensions {
291280 /**
292281 * The contact information for the exposed API.
293282 */
···324313 * url: https://www.apache.org/licenses/LICENSE-2.0.html
325314 * ```
326315 */
327327-export interface LicenseObject extends SpecificationExtensions {
316316+export interface LicenseObject extends OpenAPIExtensions {
328317 /**
329318 * **REQUIRED**. The license name used for the API.
330319 */
···350339 *
351340 * TODO: examples
352341 */
353353-export interface LinkObject extends SpecificationExtensions {
342342+export interface LinkObject extends OpenAPIExtensions {
354343 /**
355344 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
356345 */
···386375 *
387376 * TODO: examples
388377 */
389389-export interface MediaTypeObject extends SpecificationExtensions {
378378+export interface MediaTypeObject extends OpenAPIExtensions {
390379 /**
391380 * 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.
392381 */
···412401 *
413402 * TODO: examples
414403 */
415415-export interface OAuthFlowObject extends SpecificationExtensions {
404404+export interface OAuthFlowObject extends OpenAPIExtensions {
416405 /**
417406 * **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.
418407 */
···436425 *
437426 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}.
438427 */
439439-export interface OAuthFlowsObject extends SpecificationExtensions {
428428+export interface OAuthFlowsObject extends OpenAPIExtensions {
440429 /**
441430 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0.
442431 */
···462451 *
463452 * TODO: examples
464453 */
465465-export interface OperationObject extends SpecificationExtensions {
454454+export interface OperationObject extends OpenAPIExtensions {
466455 /**
467456 * 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.
468457 */
···561550 *
562551 * TODO: examples
563552 */
564564-export interface ParameterObject extends SpecificationExtensions {
553553+export interface ParameterObject extends OpenAPIExtensions {
565554 /**
566555 * 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.
567556 */
···633622 *
634623 * TODO: examples
635624 */
636636-export interface PathItemObject extends SpecificationExtensions {
625625+export interface PathItemObject extends OpenAPIExtensions {
637626 /**
638627 * 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}.
639628 */
···695684 *
696685 * TODO: examples
697686 */
698698-export interface PathsObject extends SpecificationExtensions {
687687+export interface PathsObject extends OpenAPIExtensions {
699688 /**
700689 * 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.
701690 */
···743732 *
744733 * TODO: examples
745734 */
746746-export interface RequestBodyObject extends SpecificationExtensions {
735735+export interface RequestBodyObject extends OpenAPIExtensions {
747736 /**
748737 * **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/*"`
749738 */
···765754 *
766755 * TODO: examples
767756 */
768768-export interface ResponseObject extends SpecificationExtensions {
757757+export interface ResponseObject extends OpenAPIExtensions {
769758 /**
770759 * 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/*"`
771760 */
···797786 *
798787 * TODO: examples
799788 */
800800-export interface ResponsesObject extends SpecificationExtensions {
789789+export interface ResponsesObject extends OpenAPIExtensions {
801790 /**
802791 * 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.
803792 */
···859848 *
860849 * TODO: content, examples
861850 */
862862-export interface SchemaObject extends EnumExtensions, SpecificationExtensions {
851851+export interface SchemaObject extends EnumExtensions, OpenAPIExtensions {
863852 /**
864853 * The value of "additionalProperties" MUST be a boolean or a schema.
865854 *
···11121101 *
11131102 * TODO: examples
11141103 */
11151115-export type SecuritySchemeObject = SpecificationExtensions & {
11041104+export type SecuritySchemeObject = OpenAPIExtensions & {
11161105 /**
11171106 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
11181107 */
···11751164 *
11761165 * TODO: examples
11771166 */
11781178-export interface ServerObject extends SpecificationExtensions {
11671167+export interface ServerObject extends OpenAPIExtensions {
11791168 /**
11801169 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
11811170 */
···11951184 *
11961185 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}.
11971186 */
11981198-export interface ServerVariableObject extends SpecificationExtensions {
11871187+export interface ServerVariableObject extends OpenAPIExtensions {
11991188 /**
12001189 * **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.
12011190 */
···12221211 * description: Pets operations
12231212 * ```
12241213 */
12251225-export interface TagObject extends SpecificationExtensions {
12141214+export interface TagObject extends OpenAPIExtensions {
12261215 /**
12271216 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
12281217 */
···12511240 *
12521241 * TODO: examples
12531242 */
12541254-export interface XMLObject extends SpecificationExtensions {
12431243+export interface XMLObject extends OpenAPIExtensions {
12551244 /**
12561245 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`.
12571246 */
···12871276 | 'date-time'
12881277 | 'password';
1289127812901290-type Format = JsonSchemaFormats | OpenApiSchemaFormats | AnyString;
12791279+type Format = JsonSchemaFormats | OpenApiSchemaFormats | (string & {});
···11import type { AnyString, MaybeArray } from '@hey-api/types';
2233-import type { EnumExtensions } from '../../../openApi/shared/types';
44-import type { SpecificationExtensions } from './spec';
55-import type { OpenApiSchemaExtensions } from './spec-extensions';
33+import type { EnumExtensions, OpenAPIExtensions } from '../../extensions/openapi';
44+import type { OpenAPIV3_1SchemaExtensions } from '../../openapi/v3-1/extensions';
6576// TODO: left out some keywords related to structuring a complex schema and declaring a dialect
88-export interface JsonSchemaDraft2020_12
77+export interface Document
98 extends
109 ArrayKeywords,
1110 NumberKeywords,
1211 ObjectKeywords,
1312 StringKeywords,
1413 EnumExtensions,
1515- OpenApiSchemaExtensions,
1616- SpecificationExtensions {
1414+ OpenAPIV3_1SchemaExtensions,
1515+ OpenAPIExtensions {
1716 /**
1817 * 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.
1918 */
···3130 *
3231 * {@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.
3332 */
3434- allOf?: ReadonlyArray<JsonSchemaDraft2020_12>;
3333+ allOf?: ReadonlyArray<Document>;
3534 /**
3635 * `anyOf`: (OR) Must be valid against _any_ of the subschemas
3736 *
3837 * To validate against `anyOf`, the given data must be valid against any (one or more) of the given subschemas.
3938 */
4040- anyOf?: ReadonlyArray<JsonSchemaDraft2020_12>;
3939+ anyOf?: ReadonlyArray<Document>;
4140 /**
4241 * The `const` keyword is used to restrict a value to a single value.
4342 */
···6766 /**
6867 * 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.
6968 */
7070- dependentSchemas?: Record<string, JsonSchemaDraft2020_12>;
6969+ dependentSchemas?: Record<string, Document>;
7170 /**
7271 * 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.
7372 */
···8584 *
8685 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored.
8786 */
8888- else?: JsonSchemaDraft2020_12;
8787+ else?: Document;
8988 /**
9089 * 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.
9190 *
···113112 *
114113 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored.
115114 */
116116- if?: JsonSchemaDraft2020_12;
115115+ if?: Document;
117116 /**
118117 * `not`: (NOT) Must _not_ be valid against the given schema
119118 *
120119 * The `not` keyword declares that an instance validates if it doesn't validate against the given subschema.
121120 */
122122- not?: JsonSchemaDraft2020_12;
121121+ not?: Document;
123122 /**
124123 * `oneOf`: (XOR) Must be valid against _exactly one_ of the subschemas
125124 *
···127126 *
128127 * 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.
129128 */
130130- oneOf?: ReadonlyArray<JsonSchemaDraft2020_12>;
129129+ oneOf?: ReadonlyArray<Document>;
131130 /**
132131 * 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.
133132 */
···141140 *
142141 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored.
143142 */
144144- then?: JsonSchemaDraft2020_12;
143143+ then?: Document;
145144 /**
146145 * 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.
147146 */
···156155 writeOnly?: boolean;
157156}
158157159159-interface ArrayKeywords {
158158+export interface ArrayKeywords {
160159 /**
161160 * 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.
162161 */
163163- contains?: JsonSchemaDraft2020_12;
162162+ contains?: Document;
164163 /**
165164 * 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.
166165 *
···168167 *
169168 * 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}.
170169 */
171171- items?: JsonSchemaDraft2020_12 | false;
170170+ items?: Document | false;
172171 /**
173172 * `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.
174173 */
···188187 /**
189188 * `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.
190189 */
191191- prefixItems?: ReadonlyArray<JsonSchemaDraft2020_12>;
190190+ prefixItems?: ReadonlyArray<Document>;
192191 /**
193192 * The `unevaluatedItems` keyword is useful mainly when you want to add or disallow extra items to an array.
194193 *
···198197 *
199198 * Like with `items`, if you set `unevaluatedItems` to false, you can disallow extra items in the array.
200199 */
201201- unevaluatedItems?: JsonSchemaDraft2020_12 | false;
200200+ unevaluatedItems?: Document | false;
202201 /**
203202 * A schema can ensure that each of the items in an array is unique. Simply set the `uniqueItems` keyword to `true`.
204203 */
205204 uniqueItems?: boolean;
206205}
207206208208-interface NumberKeywords {
207207+export interface NumberKeywords {
209208 /**
210209 * Ranges of numbers are specified using a combination of the `minimum` and `maximum` keywords, (or `exclusiveMinimum` and `exclusiveMaximum` for expressing exclusive range).
211210 *
···272271 multipleOf?: number;
273272}
274273275275-interface ObjectKeywords {
274274+export interface ObjectKeywords {
276275 /**
277276 * 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.
278277 *
···280279 *
281280 * 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}.
282281 */
283283- additionalProperties?: JsonSchemaDraft2020_12 | false;
282282+ additionalProperties?: Document | false;
284283 /**
285284 * 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.
286285 */
···292291 /**
293292 * 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.
294293 */
295295- patternProperties?: Record<string, JsonSchemaDraft2020_12>;
294294+ patternProperties?: Record<string, Document>;
296295 /**
297296 * 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.
298297 */
299299- properties?: Record<string, JsonSchemaDraft2020_12 | true>;
298298+ properties?: Record<string, Document | true>;
300299 /**
301300 * 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.
302301 *
···306305 * { "type": "string" }
307306 * ```
308307 */
309309- propertyNames?: JsonSchemaDraft2020_12;
308308+ propertyNames?: Document;
310309 /**
311310 * 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.
312311 *
···318317 *
319318 * `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.
320319 */
321321- unevaluatedProperties?: JsonSchemaDraft2020_12 | false;
320320+ unevaluatedProperties?: Document | false;
322321}
323322324324-interface StringKeywords {
323323+export interface StringKeywords {
325324 /**
326325 * 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.
327326 */
···336335 pattern?: string;
337336}
338337339339-type JsonSchemaFormats =
338338+export type JsonSchemaFormats =
340339 | 'date'
341340 | 'date-time'
342341 | 'duration'
···358357 | 'uuid'
359358 | AnyString;
360359361361-type JsonSchemaTypes = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
360360+export type JsonSchemaTypes =
361361+ | 'array'
362362+ | 'boolean'
363363+ | 'integer'
364364+ | 'null'
365365+ | 'number'
366366+ | 'object'
367367+ | 'string';
···11import type { DiscriminatorObject, ExternalDocumentationObject, XMLObject } from './spec';
2233-export interface OpenApiSchemaExtensions {
33+export interface OpenAPIV3_1SchemaExtensions {
44 /**
55 * 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.
66 */
···11-import type { CodeSampleObject } from '../../../openApi/shared/types';
22-import type { JsonSchemaDraft2020_12 } from './json-schema-draft-2020-12';
33-44-/**
55- * OpenAPI Specification Extensions.
66- *
77- * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
88- */
99-export interface SpecificationExtensions {
1010- [extension: `x-${string}`]: unknown;
1111-}
11+import type { CodeSampleObject, OpenAPIExtensions } from '../../extensions/openapi';
22+import type { Document as JSONSchemaDraft2020_12 } from '../../json-schema/draft-2020-12';
123134/**
145 * 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}.
156 *
167 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
178 */
1818-export interface OpenApiV3_1_X extends SpecificationExtensions {
99+export interface Document extends OpenAPIExtensions {
1910 /**
2011 * An element to hold various schemas for the document.
2112 */
···139130 * description: callback successfully processed
140131 * ```
141132 */
142142-export interface CallbackObject extends SpecificationExtensions {
133133+export interface CallbackObject extends OpenAPIExtensions {
143134 /**
144135 * 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.
145136 */
···235226 * read:pets: read your pets
236227 * ```
237228 */
238238-export interface ComponentsObject extends SpecificationExtensions {
229229+export interface ComponentsObject extends OpenAPIExtensions {
239230 /**
240231 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}.
241232 */
···290281 * email: support@example.com
291282 * ```
292283 */
293293-export interface ContactObject extends SpecificationExtensions {
284284+export interface ContactObject extends OpenAPIExtensions {
294285 /**
295286 * The email address of the contact person/organization. This MUST be in the form of an email address.
296287 */
···431422 *
432423 * will map to `Dog` because of the definition in the `mapping` element.
433424 */
434434-export interface DiscriminatorObject extends SpecificationExtensions {
425425+export interface DiscriminatorObject extends OpenAPIExtensions {
435426 /**
436427 * An object to hold mappings between payload values and schema names or references.
437428 */
···483474 * type: integer
484475 * ```
485476 */
486486-export interface EncodingObject extends SpecificationExtensions {
477477+export interface EncodingObject extends OpenAPIExtensions {
487478 /**
488479 * 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.
489480 */
···579570 * $ref: '#/components/examples/confirmation-success'
580571 * ```
581572 */
582582-export interface ExampleObject extends SpecificationExtensions {
573573+export interface ExampleObject extends OpenAPIExtensions {
583574 /**
584575 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
585576 */
···609600 * url: https://example.com
610601 * ```
611602 */
612612-export interface ExternalDocumentationObject extends SpecificationExtensions {
603603+export interface ExternalDocumentationObject extends OpenAPIExtensions {
613604 /**
614605 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
615606 */
···657648 * version: 1.0.1
658649 * ```
659650 */
660660-export interface InfoObject extends SpecificationExtensions {
651651+export interface InfoObject extends OpenAPIExtensions {
661652 /**
662653 * The contact information for the exposed API.
663654 */
···699690 * identifier: Apache-2.0
700691 * ```
701692 */
702702-export interface LicenseObject extends SpecificationExtensions {
693693+export interface LicenseObject extends OpenAPIExtensions {
703694 /**
704695 * An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field.
705696 */
···861852 *
862853 * Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with `{}` curly braces.
863854 */
864864-export interface LinkObject extends SpecificationExtensions {
855855+export interface LinkObject extends OpenAPIExtensions {
865856 /**
866857 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
867858 */
···921912 * $ref: "#/components/examples/frog-example"
922913 * ```
923914 */
924924-export interface MediaTypeObject extends SpecificationExtensions {
915915+export interface MediaTypeObject extends OpenAPIExtensions {
925916 /**
926917 * 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`.
927918 */
···963954 * read:pets: read your pets
964955 * ```
965956 */
966966-export interface OAuthFlowObject extends SpecificationExtensions {
957957+export interface OAuthFlowObject extends OpenAPIExtensions {
967958 /**
968959 * **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.
969960 */
···987978 *
988979 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
989980 */
990990-export interface OAuthFlowsObject extends SpecificationExtensions {
981981+export interface OAuthFlowsObject extends OpenAPIExtensions {
991982 /**
992983 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0.
993984 */
···10551046 * - read:pets
10561047 * ```
10571048 */
10581058-export interface OperationObject extends SpecificationExtensions {
10491049+export interface OperationObject extends OpenAPIExtensions {
10591050 /**
10601051 * 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.
10611052 */
···12071198 * type: number
12081199 * ```
12091200 */
12101210-export interface ParameterObject extends SpecificationExtensions {
12011201+export interface ParameterObject extends OpenAPIExtensions {
12111202 /**
12121203 * 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.
12131204 */
···13101301 * style: simple
13111302 * ```
13121303 */
13131313-export interface PathItemObject extends SpecificationExtensions {
13041304+export interface PathItemObject extends OpenAPIExtensions {
13141305 /**
13151306 * 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}.
13161307 */
···14101401 * $ref: '#/components/schemas/pet'
14111402 * ```
14121403 */
14131413-export interface PathsObject extends SpecificationExtensions {
14041404+export interface PathsObject extends OpenAPIExtensions {
14141405 /**
14151406 * 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.
14161407 */
···15151506 * type: string
15161507 * ```
15171508 */
15181518-export interface RequestBodyObject extends SpecificationExtensions {
15091509+export interface RequestBodyObject extends OpenAPIExtensions {
15191510 /**
15201511 * **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/*
15211512 */
···15911582 * description: object created
15921583 * ```
15931584 */
15941594-export interface ResponseObject extends SpecificationExtensions {
15851585+export interface ResponseObject extends OpenAPIExtensions {
15951586 /**
15961587 * 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/*
15971588 */
···16391630 * $ref: '#/components/schemas/ErrorModel'
16401631 * ```
16411632 */
16421642-export interface ResponsesObject extends SpecificationExtensions {
16331633+export interface ResponsesObject extends OpenAPIExtensions {
16431634 /**
16441635 * 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.
16451636 */
···16741665 *
16751666 * 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.
16761667 */
16771677-export type SchemaObject = JsonSchemaDraft2020_12 & SpecificationExtensions;
16681668+export type SchemaObject = JSONSchemaDraft2020_12 & OpenAPIExtensions;
1678166916791670/**
16801671 * 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}.
···17611752 * read:pets: read your pets
17621753 * ```
17631754 */
17641764-export type SecuritySchemeObject = SpecificationExtensions & {
17551755+export type SecuritySchemeObject = OpenAPIExtensions & {
17651756 /**
17661757 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
17671758 */
···18341825 * description: Development server
18351826 * ```
18361827 */
18371837-export interface ServerObject extends SpecificationExtensions {
18281828+export interface ServerObject extends OpenAPIExtensions {
18381829 /**
18391830 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
18401831 */
···18541845 *
18551846 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
18561847 */
18571857-export interface ServerVariableObject extends SpecificationExtensions {
18481848+export interface ServerVariableObject extends OpenAPIExtensions {
18581849 /**
18591850 * **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.
18601851 */
···18801871 * description: Pets operations
18811872 * ```
18821873 */
18831883-export interface TagObject extends SpecificationExtensions {
18741874+export interface TagObject extends OpenAPIExtensions {
18841875 /**
18851876 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
18861877 */
···20872078 * </aliens>
20882079 * ```
20892080 */
20902090-export interface XMLObject extends SpecificationExtensions {
20812081+export interface XMLObject extends OpenAPIExtensions {
20912082 /**
20922083 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`.
20932084 */
···11import type { Logger } from '@hey-api/codegen-core';
22+import type { OpenAPIV3_1 } from '@hey-api/spec-types';
2334import type { Parser } from '../../../config/parser/types';
45import { createOperationKey } from '../../../ir/operation';
55-import type { PathItemObject, PathsObject } from '../../../openApi/3.1.x/types/spec';
66import type { OpenApi } from '../../../openApi/types';
77import type { ResourceMetadata } from '../graph/meta';
88import { httpMethods } from './operation';
···109109}) => {
110110 if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) {
111111 for (const entry of Object.entries(spec.paths)) {
112112- const path = entry[0] as keyof PathsObject;
113113- const pathItem = entry[1] as PathItemObject;
112112+ const path = entry[0] as keyof OpenAPIV3_1.PathsObject;
113113+ const pathItem = entry[1] as OpenAPIV3_1.PathItemObject;
114114 for (const method of httpMethods) {
115115 const operation = pathItem[method];
116116 if (!operation) {
···161161}) => {
162162 if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) {
163163 for (const entry of Object.entries(spec.paths)) {
164164- const path = entry[0] as keyof PathsObject;
165165- const pathItem = entry[1] as PathItemObject;
164164+ const path = entry[0] as keyof OpenAPIV3_1.PathsObject;
165165+ const pathItem = entry[1] as OpenAPIV3_1.PathItemObject;
166166 for (const method of httpMethods) {
167167 const operation = pathItem[method];
168168 if (!operation) {
+19-29
packages/shared/src/openApi/types.ts
···11/* eslint-disable @typescript-eslint/no-namespace */
22-import type { OpenApiV2_0_X, OpenApiV2_0_XTypes } from './2.0.x';
33-import type { OpenApiV3_0_X, OpenApiV3_0_XTypes } from './3.0.x';
44-import type { OpenApiV3_1_X, OpenApiV3_1_XTypes } from './3.1.x';
22+import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@hey-api/spec-types';
5364export namespace OpenApi {
77- export type V2_0_X = OpenApiV2_0_X;
55+ export type V2_0_X = OpenAPIV2.Document;
8699- export type V3_0_X = OpenApiV3_0_X;
77+ export type V3_0_X = OpenAPIV3.Document;
1081111- export type V3_1_X = OpenApiV3_1_X;
99+ export type V3_1_X = OpenAPIV3_1.Document;
1210}
13111412export namespace OpenApiMetaObject {
1515- export type V2_0_X = OpenApiV2_0_XTypes['InfoObject'];
1313+ export type V2_0_X = OpenAPIV2.InfoObject;
16141717- export type V3_0_X = OpenApiV3_0_XTypes['InfoObject'];
1515+ export type V3_0_X = OpenAPIV3.InfoObject;
18161919- export type V3_1_X = OpenApiV3_1_XTypes['InfoObject'];
1717+ export type V3_1_X = OpenAPIV3_1.InfoObject;
2018}
21192220export namespace OpenApiOperationObject {
2323- export type V2_0_X = OpenApiV2_0_XTypes['OperationObject'];
2121+ export type V2_0_X = OpenAPIV2.OperationObject;
24222525- export type V3_0_X = OpenApiV3_0_XTypes['OperationObject'];
2323+ export type V3_0_X = OpenAPIV3.OperationObject;
26242727- export type V3_1_X = OpenApiV3_1_XTypes['OperationObject'];
2525+ export type V3_1_X = OpenAPIV3_1.OperationObject;
2826}
29273028export namespace OpenApiParameterObject {
3131- export type V3_0_X =
3232- | OpenApiV3_0_XTypes['ParameterObject']
3333- | OpenApiV3_0_XTypes['ReferenceObject'];
2929+ export type V3_0_X = OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject;
34303535- export type V3_1_X =
3636- | OpenApiV3_1_XTypes['ParameterObject']
3737- | OpenApiV3_1_XTypes['ReferenceObject'];
3131+ export type V3_1_X = OpenAPIV3_1.ParameterObject | OpenAPIV3_1.ReferenceObject;
3832}
39334034export namespace OpenApiRequestBodyObject {
4141- export type V3_0_X =
4242- | OpenApiV3_0_XTypes['RequestBodyObject']
4343- | OpenApiV3_0_XTypes['ReferenceObject'];
3535+ export type V3_0_X = OpenAPIV3.RequestBodyObject | OpenAPIV3.ReferenceObject;
44364545- export type V3_1_X =
4646- | OpenApiV3_1_XTypes['RequestBodyObject']
4747- | OpenApiV3_1_XTypes['ReferenceObject'];
3737+ export type V3_1_X = OpenAPIV3_1.RequestBodyObject | OpenAPIV3_1.ReferenceObject;
4838}
49395040export namespace OpenApiResponseObject {
5151- export type V3_0_X = OpenApiV3_0_XTypes['ResponseObject'] | OpenApiV3_0_XTypes['ReferenceObject'];
4141+ export type V3_0_X = OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject;
52425353- export type V3_1_X = OpenApiV3_1_XTypes['ResponseObject'] | OpenApiV3_1_XTypes['ReferenceObject'];
4343+ export type V3_1_X = OpenAPIV3_1.ResponseObject | OpenAPIV3_1.ReferenceObject;
5444}
55455646export namespace OpenApiSchemaObject {
5757- export type V2_0_X = OpenApiV2_0_XTypes['SchemaObject'];
4747+ export type V2_0_X = OpenAPIV2.SchemaObject;
58485959- export type V3_0_X = OpenApiV3_0_XTypes['SchemaObject'];
4949+ export type V3_0_X = OpenAPIV3.SchemaObject;
60506161- export type V3_1_X = OpenApiV3_1_XTypes['SchemaObject'];
5151+ export type V3_1_X = OpenAPIV3_1.SchemaObject;
6252}
+21
packages/spec-types/LICENSE.md
···11+MIT License
22+33+Copyright (c) Hey API
44+55+Permission is hereby granted, free of charge, to any person obtaining a copy
66+of this software and associated documentation files (the "Software"), to deal
77+in the Software without restriction, including without limitation the rights
88+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+copies of the Software, and to permit persons to whom the Software is
1010+furnished to do so, subject to the following conditions:
1111+1212+The above copyright notice and this permission notice shall be included in all
1313+copies or substantial portions of the Software.
1414+1515+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+SOFTWARE.
···11+export type {
22+ CodeSampleObject,
33+ EnumExtensions,
44+ LinguistLanguages,
55+ OpenAPIExtensions,
66+} from './extensions/openapi';
77+export type * as JSONSchemaDraft4 from './json-schema/draft-4';
88+export type * as JSONSchemaDraft2020_12 from './json-schema/draft-2020-12';
99+export * as JSONSchema from './json-schema/union';
1010+export * as OpenApi from './openapi/union';
1111+export type * as OpenAPIV2 from './openapi/v2';
1212+export type * as OpenAPIV3 from './openapi/v3';
1313+export type * as OpenAPIV3_1 from './openapi/v3-1';
···11+import type { Document as JSONSchemaDraft4 } from './draft-4';
22+import type { Document as JSONSchemaDraft2020_12 } from './draft-2020-12';
33+44+/**
55+ * Union of all supported JSON Schema document versions.
66+ */
77+export type Document = JSONSchemaDraft4 | JSONSchemaDraft2020_12;
+8
packages/spec-types/src/openapi/union.ts
···11+import type { Document as OpenAPIV2 } from './v2';
22+import type { Document as OpenAPIV3 } from './v3';
33+import type { Document as OpenAPIV3_1 } from './v3-1';
44+55+/**
66+ * Union of all supported OpenAPI document versions.
77+ */
88+export type Document = OpenAPIV2 | OpenAPIV3 | OpenAPIV3_1;
+2
packages/spec-types/src/openapi/v2/index.ts
···11+export type { OpenAPIV2NullableExtensions as NullableExtensions } from './extensions';
22+export type * from './spec';
+2
packages/spec-types/src/openapi/v3-1/index.ts
···11+export type { OpenAPIV3_1SchemaExtensions as Extensions } from './extensions';
22+export type * from './spec';