fork of hey-api/openapi-ts because I need some additional things

refactor: Extract SpecificationExtensions type and apply to all spec interfaces

- Created SpecificationExtensions interface in 3.0.x and 3.1.x spec.d.ts
- Applied to all 27 interfaces that support extensions in each version
- Replaced inline `[extension: x-${string}]: unknown` with extends clause
- Also added SpecificationExtensions to JsonSchemaDraft2020_12

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

Changed files
+179 -161
packages
openapi-ts
src
openApi
+82 -77
packages/openapi-ts/src/openApi/3.0.x/types/spec.d.ts
··· 1 import type { EnumExtensions } from '~/openApi/shared/types/openapi-spec-extensions'; 2 3 /** 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}. 5 * 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}. 7 */ 8 - export interface OpenApiV3_0_X { 9 /** 10 * An element to hold various Objects for the OpenAPI Description. 11 */ ··· 47 * 48 * TODO: examples 49 */ 50 - export interface CallbackObject { 51 /** 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. 53 */ ··· 63 * 64 * TODO: examples 65 */ 66 - export interface ComponentsObject { 67 /** 68 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#callback-object Callback Objects}. 69 */ ··· 113 * email: support@example.com 114 * ``` 115 */ 116 - export interface ContactObject { 117 /** 118 * The email address of the contact person/organization. This MUST be in the form of an email address. 119 */ ··· 160 * TODO: default values examples 161 * TODO: examples 162 */ 163 - export interface EncodingObject { 164 /** 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`. 166 */ ··· 201 * 202 * TODO: examples 203 */ 204 - export interface ExampleObject { 205 /** 206 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 207 */ ··· 232 * url: https://example.com 233 * ``` 234 */ 235 - export interface ExternalDocumentationObject { 236 /** 237 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 238 */ ··· 313 * url: https://www.apache.org/licenses/LICENSE-2.0.html 314 * ``` 315 */ 316 - export interface LicenseObject { 317 /** 318 * **REQUIRED**. The license name used for the API. 319 */ ··· 339 * 340 * TODO: examples 341 */ 342 - export interface LinkObject { 343 /** 344 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 345 */ ··· 375 * 376 * TODO: examples 377 */ 378 - export interface MediaTypeObject { 379 /** 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. 381 */ ··· 401 * 402 * TODO: examples 403 */ 404 - export interface OAuthFlowObject { 405 /** 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. 407 */ ··· 425 * 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}. 427 */ 428 - export interface OAuthFlowsObject { 429 /** 430 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 431 */ ··· 451 * 452 * TODO: examples 453 */ 454 - export interface OperationObject { 455 - [extension: `x-${string}`]: unknown; 456 /** 457 * 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. 458 */ ··· 547 * 548 * TODO: examples 549 */ 550 - export interface ParameterObject { 551 - [extension: `x-${string}`]: unknown; 552 /** 553 * 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. 554 */ ··· 620 * 621 * TODO: examples 622 */ 623 - export interface PathItemObject { 624 /** 625 * 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}. 626 */ ··· 682 * 683 * TODO: examples 684 */ 685 - export interface PathsObject { 686 /** 687 * 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. 688 */ ··· 730 * 731 * TODO: examples 732 */ 733 - export interface RequestBodyObject { 734 /** 735 * **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/*"` 736 */ ··· 752 * 753 * TODO: examples 754 */ 755 - export interface ResponseObject { 756 /** 757 * 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/*"` 758 */ ··· 784 * 785 * TODO: examples 786 */ 787 - export interface ResponsesObject { 788 /** 789 * 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. 790 */ ··· 846 * 847 * TODO: content, examples 848 */ 849 - export interface SchemaObject extends EnumExtensions { 850 - [extension: `x-${string}`]: unknown; 851 /** 852 * The value of "additionalProperties" MUST be a boolean or a schema. 853 * ··· 1100 * 1101 * TODO: examples 1102 */ 1103 - export type SecuritySchemeObject = { 1104 /** 1105 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1106 */ 1107 description?: string; 1108 } & ( 1109 - | { 1110 - /** 1111 - * **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"`, or `"cookie"`. 1112 - */ 1113 - in: 'cookie' | 'header' | 'query'; 1114 - /** 1115 - * **REQUIRED**. The name of the header, query or cookie parameter to be used. 1116 - */ 1117 - name: string; 1118 - /** 1119 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1120 - */ 1121 - type: 'apiKey'; 1122 - } 1123 - | { 1124 - /** 1125 - * A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. 1126 - */ 1127 - bearerFormat?: string; 1128 - /** 1129 - * **REQUIRED**. The name of the HTTP Authentication scheme to be used in the {@link https://tools.ietf.org/html/rfc7235#section-5.1 Authorization header as defined in RFC7235}. The values used SHOULD be registered in the {@link https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml IANA Authentication Scheme registry}. The value is case-insensitive, as defined in {@link https://datatracker.ietf.org/doc/html/rfc7235#section-2.1 RFC7235}. 1130 - */ 1131 - scheme: string; 1132 - /** 1133 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1134 - */ 1135 - type: 'http'; 1136 - } 1137 - | { 1138 - /** 1139 - * **REQUIRED**. An object containing configuration information for the flow types supported. 1140 - */ 1141 - flows: OAuthFlowsObject; 1142 - /** 1143 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1144 - */ 1145 - type: 'oauth2'; 1146 - } 1147 - | { 1148 - /** 1149 - * **REQUIRED**. {@link https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig Well-known URL} to discover the [[OpenID-Connect-Discovery]] {@link https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata provider metadata}. 1150 - */ 1151 - openIdConnectUrl: string; 1152 - /** 1153 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1154 - */ 1155 - type: 'openIdConnect'; 1156 - } 1157 - ); 1158 1159 /** 1160 * An object representing a Server. ··· 1163 * 1164 * TODO: examples 1165 */ 1166 - export interface ServerObject { 1167 /** 1168 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1169 */ ··· 1183 * 1184 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 1185 */ 1186 - export interface ServerVariableObject { 1187 /** 1188 * **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. 1189 */ ··· 1210 * description: Pets operations 1211 * ``` 1212 */ 1213 - export interface TagObject { 1214 /** 1215 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1216 */ ··· 1239 * 1240 * TODO: examples 1241 */ 1242 - export interface XMLObject { 1243 /** 1244 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 1245 */
··· 1 import type { EnumExtensions } from '~/openApi/shared/types/openapi-spec-extensions'; 2 3 /** 4 + * Type for OpenAPI Specification Extensions (x-* fields). 5 + * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 6 + */ 7 + export interface SpecificationExtensions { 8 + [extension: `x-${string}`]: unknown; 9 + } 10 + 11 + /** 12 * 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}. 13 * 14 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 15 */ 16 + export interface OpenApiV3_0_X extends SpecificationExtensions { 17 /** 18 * An element to hold various Objects for the OpenAPI Description. 19 */ ··· 55 * 56 * TODO: examples 57 */ 58 + export interface CallbackObject extends SpecificationExtensions { 59 /** 60 * 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. 61 */ ··· 71 * 72 * TODO: examples 73 */ 74 + export interface ComponentsObject extends SpecificationExtensions { 75 /** 76 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#callback-object Callback Objects}. 77 */ ··· 121 * email: support@example.com 122 * ``` 123 */ 124 + export interface ContactObject extends SpecificationExtensions { 125 /** 126 * The email address of the contact person/organization. This MUST be in the form of an email address. 127 */ ··· 168 * TODO: default values examples 169 * TODO: examples 170 */ 171 + export interface EncodingObject extends SpecificationExtensions { 172 /** 173 * 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`. 174 */ ··· 209 * 210 * TODO: examples 211 */ 212 + export interface ExampleObject extends SpecificationExtensions { 213 /** 214 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 215 */ ··· 240 * url: https://example.com 241 * ``` 242 */ 243 + export interface ExternalDocumentationObject extends SpecificationExtensions { 244 /** 245 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 246 */ ··· 321 * url: https://www.apache.org/licenses/LICENSE-2.0.html 322 * ``` 323 */ 324 + export interface LicenseObject extends SpecificationExtensions { 325 /** 326 * **REQUIRED**. The license name used for the API. 327 */ ··· 347 * 348 * TODO: examples 349 */ 350 + export interface LinkObject extends SpecificationExtensions { 351 /** 352 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 353 */ ··· 383 * 384 * TODO: examples 385 */ 386 + export interface MediaTypeObject extends SpecificationExtensions { 387 /** 388 * 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. 389 */ ··· 409 * 410 * TODO: examples 411 */ 412 + export interface OAuthFlowObject extends SpecificationExtensions { 413 /** 414 * **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. 415 */ ··· 433 * 434 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 435 */ 436 + export interface OAuthFlowsObject extends SpecificationExtensions { 437 /** 438 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 439 */ ··· 459 * 460 * TODO: examples 461 */ 462 + export interface OperationObject extends SpecificationExtensions { 463 /** 464 * 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. 465 */ ··· 554 * 555 * TODO: examples 556 */ 557 + export interface ParameterObject extends SpecificationExtensions { 558 /** 559 * 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. 560 */ ··· 626 * 627 * TODO: examples 628 */ 629 + export interface PathItemObject extends SpecificationExtensions { 630 /** 631 * 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}. 632 */ ··· 688 * 689 * TODO: examples 690 */ 691 + export interface PathsObject extends SpecificationExtensions { 692 /** 693 * 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. 694 */ ··· 736 * 737 * TODO: examples 738 */ 739 + export interface RequestBodyObject extends SpecificationExtensions { 740 /** 741 * **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/*"` 742 */ ··· 758 * 759 * TODO: examples 760 */ 761 + export interface ResponseObject extends SpecificationExtensions { 762 /** 763 * 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/*"` 764 */ ··· 790 * 791 * TODO: examples 792 */ 793 + export interface ResponsesObject extends SpecificationExtensions { 794 /** 795 * 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. 796 */ ··· 852 * 853 * TODO: content, examples 854 */ 855 + export interface SchemaObject extends EnumExtensions, SpecificationExtensions { 856 /** 857 * The value of "additionalProperties" MUST be a boolean or a schema. 858 * ··· 1105 * 1106 * TODO: examples 1107 */ 1108 + export type SecuritySchemeObject = SpecificationExtensions & { 1109 /** 1110 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1111 */ 1112 description?: string; 1113 } & ( 1114 + | { 1115 + /** 1116 + * **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"`, or `"cookie"`. 1117 + */ 1118 + in: 'cookie' | 'header' | 'query'; 1119 + /** 1120 + * **REQUIRED**. The name of the header, query or cookie parameter to be used. 1121 + */ 1122 + name: string; 1123 + /** 1124 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1125 + */ 1126 + type: 'apiKey'; 1127 + } 1128 + | { 1129 + /** 1130 + * A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. 1131 + */ 1132 + bearerFormat?: string; 1133 + /** 1134 + * **REQUIRED**. The name of the HTTP Authentication scheme to be used in the {@link https://tools.ietf.org/html/rfc7235#section-5.1 Authorization header as defined in RFC7235}. The values used SHOULD be registered in the {@link https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml IANA Authentication Scheme registry}. The value is case-insensitive, as defined in {@link https://datatracker.ietf.org/doc/html/rfc7235#section-2.1 RFC7235}. 1135 + */ 1136 + scheme: string; 1137 + /** 1138 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1139 + */ 1140 + type: 'http'; 1141 + } 1142 + | { 1143 + /** 1144 + * **REQUIRED**. An object containing configuration information for the flow types supported. 1145 + */ 1146 + flows: OAuthFlowsObject; 1147 + /** 1148 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1149 + */ 1150 + type: 'oauth2'; 1151 + } 1152 + | { 1153 + /** 1154 + * **REQUIRED**. {@link https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig Well-known URL} to discover the [[OpenID-Connect-Discovery]] {@link https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata provider metadata}. 1155 + */ 1156 + openIdConnectUrl: string; 1157 + /** 1158 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. 1159 + */ 1160 + type: 'openIdConnect'; 1161 + } 1162 + ); 1163 1164 /** 1165 * An object representing a Server. ··· 1168 * 1169 * TODO: examples 1170 */ 1171 + export interface ServerObject extends SpecificationExtensions { 1172 /** 1173 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1174 */ ··· 1188 * 1189 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 1190 */ 1191 + export interface ServerVariableObject extends SpecificationExtensions { 1192 /** 1193 * **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. 1194 */ ··· 1215 * description: Pets operations 1216 * ``` 1217 */ 1218 + export interface TagObject extends SpecificationExtensions { 1219 /** 1220 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1221 */ ··· 1244 * 1245 * TODO: examples 1246 */ 1247 + export interface XMLObject extends SpecificationExtensions { 1248 /** 1249 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 1250 */
+9 -2
packages/openapi-ts/src/openApi/3.1.x/types/json-schema-draft-2020-12.d.ts
··· 3 import type { MaybeArray } from '../../../types/utils'; 4 import type { OpenApiSchemaExtensions } from './spec-extensions'; 5 6 // TODO: left out some keywords related to structuring a complex schema and declaring a dialect 7 export interface JsonSchemaDraft2020_12 8 extends ArrayKeywords, ··· 10 ObjectKeywords, 11 StringKeywords, 12 EnumExtensions, 13 - OpenApiSchemaExtensions { 14 - [extension: `x-${string}`]: unknown; 15 /** 16 * 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. 17 */
··· 3 import type { MaybeArray } from '../../../types/utils'; 4 import type { OpenApiSchemaExtensions } from './spec-extensions'; 5 6 + /** 7 + * Type for OpenAPI Specification Extensions (x-* fields). 8 + */ 9 + export interface SpecificationExtensions { 10 + [extension: `x-${string}`]: unknown; 11 + } 12 + 13 // TODO: left out some keywords related to structuring a complex schema and declaring a dialect 14 export interface JsonSchemaDraft2020_12 15 extends ArrayKeywords, ··· 17 ObjectKeywords, 18 StringKeywords, 19 EnumExtensions, 20 + OpenApiSchemaExtensions, 21 + SpecificationExtensions { 22 /** 23 * 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. 24 */
+88 -82
packages/openapi-ts/src/openApi/3.1.x/types/spec.d.ts
··· 1 import type { JsonSchemaDraft2020_12 } from './json-schema-draft-2020-12'; 2 3 /** 4 * 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}. 5 * 6 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 7 */ 8 - export interface OpenApiV3_1_X { 9 /** 10 * An element to hold various schemas for the document. 11 */ ··· 129 * description: callback successfully processed 130 * ``` 131 */ 132 - export interface CallbackObject { 133 /** 134 * 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. 135 */ ··· 225 * read:pets: read your pets 226 * ``` 227 */ 228 - export interface ComponentsObject { 229 /** 230 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}. 231 */ ··· 280 * email: support@example.com 281 * ``` 282 */ 283 - export interface ContactObject { 284 /** 285 * The email address of the contact person/organization. This MUST be in the form of an email address. 286 */ ··· 473 * type: integer 474 * ``` 475 */ 476 - export interface EncodingObject { 477 /** 478 * 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. 479 */ ··· 569 * $ref: '#/components/examples/confirmation-success' 570 * ``` 571 */ 572 - export interface ExampleObject { 573 /** 574 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 575 */ ··· 599 * url: https://example.com 600 * ``` 601 */ 602 - export interface ExternalDocumentationObject { 603 /** 604 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 605 */ ··· 647 * version: 1.0.1 648 * ``` 649 */ 650 - export interface InfoObject { 651 /** 652 * The contact information for the exposed API. 653 */ ··· 689 * identifier: Apache-2.0 690 * ``` 691 */ 692 - export interface LicenseObject { 693 /** 694 * An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field. 695 */ ··· 851 * 852 * Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. 853 */ 854 - export interface LinkObject { 855 /** 856 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 857 */ ··· 911 * $ref: "#/components/examples/frog-example" 912 * ``` 913 */ 914 - export interface MediaTypeObject { 915 /** 916 * 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`. 917 */ ··· 953 * read:pets: read your pets 954 * ``` 955 */ 956 - export interface OAuthFlowObject { 957 /** 958 * **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. 959 */ ··· 977 * 978 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 979 */ 980 - export interface OAuthFlowsObject { 981 /** 982 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 983 */ ··· 1045 * - read:pets 1046 * ``` 1047 */ 1048 - export interface OperationObject { 1049 - [extension: `x-${string}`]: unknown; 1050 /** 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. 1052 */ ··· 1194 * type: number 1195 * ``` 1196 */ 1197 - export interface ParameterObject { 1198 - [extension: `x-${string}`]: unknown; 1199 /** 1200 * 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. 1201 */ ··· 1298 * style: simple 1299 * ``` 1300 */ 1301 - export interface PathItemObject { 1302 /** 1303 * 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}. 1304 */ ··· 1398 * $ref: '#/components/schemas/pet' 1399 * ``` 1400 */ 1401 - export interface PathsObject { 1402 /** 1403 * 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. 1404 */ ··· 1503 * type: string 1504 * ``` 1505 */ 1506 - export interface RequestBodyObject { 1507 /** 1508 * **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/* 1509 */ ··· 1579 * description: object created 1580 * ``` 1581 */ 1582 - export interface ResponseObject { 1583 /** 1584 * 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/* 1585 */ ··· 1627 * $ref: '#/components/schemas/ErrorModel' 1628 * ``` 1629 */ 1630 - export interface ResponsesObject { 1631 /** 1632 * 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. 1633 */ ··· 1749 * read:pets: read your pets 1750 * ``` 1751 */ 1752 - export type SecuritySchemeObject = { 1753 /** 1754 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1755 */ 1756 description?: string; 1757 } & ( 1758 - | { 1759 - /** 1760 - * **REQUIRED**. The location of the API key. Valid values are "query", "header" or "cookie". 1761 - */ 1762 - in: 'cookie' | 'header' | 'query'; 1763 - /** 1764 - * **REQUIRED**. The name of the header, query or cookie parameter to be used. 1765 - */ 1766 - name: string; 1767 - /** 1768 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1769 - */ 1770 - type: 'apiKey'; 1771 - } 1772 - | { 1773 - /** 1774 - * A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. 1775 - */ 1776 - bearerFormat?: string; 1777 - /** 1778 - * **REQUIRED**. The name of the HTTP Authorization scheme to be used in the {@link https://tools.ietf.org/html/rfc7235#section-5.1 Authorization header as defined in RFC7235}. The values used SHOULD be registered in the {@link https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml IANA Authentication Scheme registry}. 1779 - */ 1780 - scheme: string; 1781 - /** 1782 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1783 - */ 1784 - type: 'http'; 1785 - } 1786 - | { 1787 - /** 1788 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1789 - */ 1790 - type: 'mutualTLS'; 1791 - } 1792 - | { 1793 - /** 1794 - * **REQUIRED**. An object containing configuration information for the flow types supported. 1795 - */ 1796 - flows: OAuthFlowsObject; 1797 - /** 1798 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1799 - */ 1800 - type: 'oauth2'; 1801 - } 1802 - | { 1803 - /** 1804 - * **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. The OpenID Connect standard requires the use of TLS. 1805 - */ 1806 - openIdConnectUrl: string; 1807 - /** 1808 - * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1809 - */ 1810 - type: 'openIdConnect'; 1811 - } 1812 - ); 1813 1814 /** 1815 * An object representing a Server. ··· 1822 * description: Development server 1823 * ``` 1824 */ 1825 - export interface ServerObject { 1826 /** 1827 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1828 */ ··· 1842 * 1843 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 1844 */ 1845 - export interface ServerVariableObject { 1846 /** 1847 * **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. 1848 */ ··· 1868 * description: Pets operations 1869 * ``` 1870 */ 1871 - export interface TagObject { 1872 /** 1873 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1874 */ ··· 2075 * </aliens> 2076 * ``` 2077 */ 2078 - export interface XMLObject { 2079 /** 2080 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 2081 */
··· 1 import type { JsonSchemaDraft2020_12 } from './json-schema-draft-2020-12'; 2 3 /** 4 + * Type for OpenAPI Specification Extensions (x-* fields). 5 + * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 6 + */ 7 + export interface SpecificationExtensions { 8 + [extension: `x-${string}`]: unknown; 9 + } 10 + 11 + /** 12 * 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}. 13 * 14 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 15 */ 16 + export interface OpenApiV3_1_X extends SpecificationExtensions { 17 /** 18 * An element to hold various schemas for the document. 19 */ ··· 137 * description: callback successfully processed 138 * ``` 139 */ 140 + export interface CallbackObject extends SpecificationExtensions { 141 /** 142 * 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. 143 */ ··· 233 * read:pets: read your pets 234 * ``` 235 */ 236 + export interface ComponentsObject extends SpecificationExtensions { 237 /** 238 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}. 239 */ ··· 288 * email: support@example.com 289 * ``` 290 */ 291 + export interface ContactObject extends SpecificationExtensions { 292 /** 293 * The email address of the contact person/organization. This MUST be in the form of an email address. 294 */ ··· 481 * type: integer 482 * ``` 483 */ 484 + export interface EncodingObject extends SpecificationExtensions { 485 /** 486 * 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. 487 */ ··· 577 * $ref: '#/components/examples/confirmation-success' 578 * ``` 579 */ 580 + export interface ExampleObject extends SpecificationExtensions { 581 /** 582 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 583 */ ··· 607 * url: https://example.com 608 * ``` 609 */ 610 + export interface ExternalDocumentationObject extends SpecificationExtensions { 611 /** 612 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 613 */ ··· 655 * version: 1.0.1 656 * ``` 657 */ 658 + export interface InfoObject extends SpecificationExtensions { 659 /** 660 * The contact information for the exposed API. 661 */ ··· 697 * identifier: Apache-2.0 698 * ``` 699 */ 700 + export interface LicenseObject extends SpecificationExtensions { 701 /** 702 * An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field. 703 */ ··· 859 * 860 * Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. 861 */ 862 + export interface LinkObject extends SpecificationExtensions { 863 /** 864 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 865 */ ··· 919 * $ref: "#/components/examples/frog-example" 920 * ``` 921 */ 922 + export interface MediaTypeObject extends SpecificationExtensions { 923 /** 924 * 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`. 925 */ ··· 961 * read:pets: read your pets 962 * ``` 963 */ 964 + export interface OAuthFlowObject extends SpecificationExtensions { 965 /** 966 * **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. 967 */ ··· 985 * 986 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 987 */ 988 + export interface OAuthFlowsObject extends SpecificationExtensions { 989 /** 990 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 991 */ ··· 1053 * - read:pets 1054 * ``` 1055 */ 1056 + export interface OperationObject extends SpecificationExtensions { 1057 /** 1058 * 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. 1059 */ ··· 1201 * type: number 1202 * ``` 1203 */ 1204 + export interface ParameterObject extends SpecificationExtensions { 1205 /** 1206 * 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. 1207 */ ··· 1304 * style: simple 1305 * ``` 1306 */ 1307 + export interface PathItemObject extends SpecificationExtensions { 1308 /** 1309 * 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}. 1310 */ ··· 1404 * $ref: '#/components/schemas/pet' 1405 * ``` 1406 */ 1407 + export interface PathsObject extends SpecificationExtensions { 1408 /** 1409 * 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. 1410 */ ··· 1509 * type: string 1510 * ``` 1511 */ 1512 + export interface RequestBodyObject extends SpecificationExtensions { 1513 /** 1514 * **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/* 1515 */ ··· 1585 * description: object created 1586 * ``` 1587 */ 1588 + export interface ResponseObject extends SpecificationExtensions { 1589 /** 1590 * 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/* 1591 */ ··· 1633 * $ref: '#/components/schemas/ErrorModel' 1634 * ``` 1635 */ 1636 + export interface ResponsesObject extends SpecificationExtensions { 1637 /** 1638 * 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. 1639 */ ··· 1755 * read:pets: read your pets 1756 * ``` 1757 */ 1758 + export type SecuritySchemeObject = SpecificationExtensions & { 1759 /** 1760 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1761 */ 1762 description?: string; 1763 } & ( 1764 + | { 1765 + /** 1766 + * **REQUIRED**. The location of the API key. Valid values are "query", "header" or "cookie". 1767 + */ 1768 + in: 'cookie' | 'header' | 'query'; 1769 + /** 1770 + * **REQUIRED**. The name of the header, query or cookie parameter to be used. 1771 + */ 1772 + name: string; 1773 + /** 1774 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1775 + */ 1776 + type: 'apiKey'; 1777 + } 1778 + | { 1779 + /** 1780 + * A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. 1781 + */ 1782 + bearerFormat?: string; 1783 + /** 1784 + * **REQUIRED**. The name of the HTTP Authorization scheme to be used in the {@link https://tools.ietf.org/html/rfc7235#section-5.1 Authorization header as defined in RFC7235}. The values used SHOULD be registered in the {@link https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml IANA Authentication Scheme registry}. 1785 + */ 1786 + scheme: string; 1787 + /** 1788 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1789 + */ 1790 + type: 'http'; 1791 + } 1792 + | { 1793 + /** 1794 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1795 + */ 1796 + type: 'mutualTLS'; 1797 + } 1798 + | { 1799 + /** 1800 + * **REQUIRED**. An object containing configuration information for the flow types supported. 1801 + */ 1802 + flows: OAuthFlowsObject; 1803 + /** 1804 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1805 + */ 1806 + type: 'oauth2'; 1807 + } 1808 + | { 1809 + /** 1810 + * **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. The OpenID Connect standard requires the use of TLS. 1811 + */ 1812 + openIdConnectUrl: string; 1813 + /** 1814 + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. 1815 + */ 1816 + type: 'openIdConnect'; 1817 + } 1818 + ); 1819 1820 /** 1821 * An object representing a Server. ··· 1828 * description: Development server 1829 * ``` 1830 */ 1831 + export interface ServerObject extends SpecificationExtensions { 1832 /** 1833 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1834 */ ··· 1848 * 1849 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 1850 */ 1851 + export interface ServerVariableObject extends SpecificationExtensions { 1852 /** 1853 * **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. 1854 */ ··· 1874 * description: Pets operations 1875 * ``` 1876 */ 1877 + export interface TagObject extends SpecificationExtensions { 1878 /** 1879 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1880 */ ··· 2081 * </aliens> 2082 * ``` 2083 */ 2084 + export interface XMLObject extends SpecificationExtensions { 2085 /** 2086 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 2087 */