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

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #3715 from hey-api/fix/spec-types

Fix/spec types

authored by

Lubos and committed by
GitHub
9f006292 05207e0e

+268 -230
+5
.changeset/clear-toes-enjoy.md
··· 1 + --- 2 + "@hey-api/spec-types": patch 3 + --- 4 + 5 + **types**: fix: use mutable arrays
+5
.changeset/deep-paws-call.md
··· 1 + --- 2 + "@hey-api/spec-types": minor 3 + --- 4 + 5 + **BREAKING**: rename `OpenAPIExtensions` to `SpecExtensions`
+5
.changeset/olive-sides-mate.md
··· 1 + --- 2 + "@hey-api/spec-types": minor 3 + --- 4 + 5 + **BREAKING**: remove OpenAPI types from JSON Schema documents
+5
.changeset/short-walls-battle.md
··· 1 + --- 2 + "@hey-api/spec-types": patch 3 + --- 4 + 5 + **openapi**: fix: stricter 2.0 version type
+5 -5
packages/shared/src/ir/types.ts
··· 1 1 /* eslint-disable @typescript-eslint/no-namespace */ 2 2 import type { Symbol } from '@hey-api/codegen-core'; 3 - import type { JSONSchemaDraft2020_12, OpenAPIExtensions, OpenAPIV3_1 } from '@hey-api/spec-types'; 3 + import type { JSONSchemaDraft2020_12, OpenAPIV3_1, SpecExtensions } from '@hey-api/spec-types'; 4 4 5 5 import type { IRMediaType } from './mediaType'; 6 6 ··· 22 22 schemas?: Record<string, IRSchemaObject>; 23 23 } 24 24 25 - export interface IROperationObject extends OpenAPIExtensions { 25 + export interface IROperationObject extends SpecExtensions { 26 26 body?: IRBodyObject; 27 27 deprecated?: boolean; 28 28 description?: string; ··· 46 46 } 47 47 48 48 export interface IRParameterObject 49 - extends Pick<JSONSchemaDraft2020_12.Document, 'deprecated' | 'description'>, OpenAPIExtensions { 49 + extends Pick<JSONSchemaDraft2020_12.Document, 'deprecated' | 'description'>, SpecExtensions { 50 50 /** 51 51 * Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of `contentType` (implicit or explicit) SHALL be ignored. 52 52 */ ··· 130 130 | 'pattern' 131 131 | 'required' 132 132 | 'title' 133 - | 'example' 134 133 >, 135 - OpenAPIExtensions { 134 + Pick<OpenAPIV3_1.SchemaObject, 'example'>, 135 + SpecExtensions { 136 136 /** 137 137 * If the schema is intended to be used as an object property, it can be 138 138 * marked as read-only or write-only. This value controls whether the schema
+4 -4
packages/spec-types/package.json
··· 37 37 ], 38 38 "type": "module", 39 39 "sideEffects": false, 40 - "types": "./dist/index.d.ts", 40 + "types": "./dist/index.d.mts", 41 41 "exports": { 42 42 ".": { 43 - "types": "./dist/index.d.ts" 43 + "types": "./dist/index.d.mts" 44 44 }, 45 45 "./package.json": "./package.json" 46 46 }, 47 47 "scripts": { 48 - "build": "tsc --build", 49 - "dev": "tsc --build --watch", 48 + "build": "tsdown", 49 + "dev": "tsdown --watch", 50 50 "prepublishOnly": "pnpm build", 51 51 "typecheck": "tsgo --noEmit" 52 52 },
+43
packages/spec-types/src/extensions/code-samples.ts
··· 1 + export type LinguistLanguages = 2 + | 'C' 3 + | 'C#' 4 + | 'C++' 5 + | 'CoffeeScript' 6 + | 'CSS' 7 + | 'Dart' 8 + | 'DM' 9 + | 'Elixir' 10 + | 'Go' 11 + | 'Groovy' 12 + | 'HTML' 13 + | 'Java' 14 + | 'JavaScript' 15 + | 'Kotlin' 16 + | 'Objective-C' 17 + | 'Perl' 18 + | 'PHP' 19 + | 'PowerShell' 20 + | 'Python' 21 + | 'Ruby' 22 + | 'Rust' 23 + | 'Scala' 24 + | 'Shell' 25 + | 'Swift' 26 + | 'TypeScript'; 27 + 28 + export interface CodeSampleObject { 29 + /** 30 + * Code sample label, for example `Node` or `Python2.7`. 31 + * 32 + * @default `lang` value 33 + */ 34 + label?: string; 35 + /** 36 + * **REQUIRED**. Code sample language. Can be one of the automatically supported languages or any other language identifier of your choice (for custom code samples). 37 + */ 38 + lang: LinguistLanguages; 39 + /** 40 + * **REQUIRED**. Code sample source code, or a `$ref` to the file containing the code sample. 41 + */ 42 + source: string; 43 + }
+14
packages/spec-types/src/extensions/enum.ts
··· 1 + export interface EnumExtensions { 2 + /** 3 + * `x-enum-descriptions` are {@link https://stackoverflow.com/a/66471626 supported} by OpenAPI Generator. 4 + */ 5 + 'x-enum-descriptions'?: Array<string>; 6 + /** 7 + * `x-enum-varnames` are {@link https://stackoverflow.com/a/66471626 supported} by OpenAPI Generator. 8 + */ 9 + 'x-enum-varnames'?: Array<string>; 10 + /** 11 + * {@link https://github.com/RicoSuter/NSwag NSwag} generates `x-enumNames` field containing custom enum names. 12 + */ 13 + 'x-enumNames'?: Array<string>; 14 + }
-67
packages/spec-types/src/extensions/openapi.ts
··· 1 - export type LinguistLanguages = 2 - | 'C' 3 - | 'C#' 4 - | 'C++' 5 - | 'CoffeeScript' 6 - | 'CSS' 7 - | 'Dart' 8 - | 'DM' 9 - | 'Elixir' 10 - | 'Go' 11 - | 'Groovy' 12 - | 'HTML' 13 - | 'Java' 14 - | 'JavaScript' 15 - | 'Kotlin' 16 - | 'Objective-C' 17 - | 'Perl' 18 - | 'PHP' 19 - | 'PowerShell' 20 - | 'Python' 21 - | 'Ruby' 22 - | 'Rust' 23 - | 'Scala' 24 - | 'Shell' 25 - | 'Swift' 26 - | 'TypeScript'; 27 - 28 - export interface CodeSampleObject { 29 - /** 30 - * Code sample label, for example `Node` or `Python2.7`. 31 - * 32 - * @default `lang` value 33 - */ 34 - label?: string; 35 - /** 36 - * **REQUIRED**. Code sample language. Can be one of the automatically supported languages or any other language identifier of your choice (for custom code samples). 37 - */ 38 - lang: LinguistLanguages; 39 - /** 40 - * **REQUIRED**. Code sample source code, or a `$ref` to the file containing the code sample. 41 - */ 42 - source: string; 43 - } 44 - 45 - export interface EnumExtensions { 46 - /** 47 - * `x-enum-descriptions` are {@link https://stackoverflow.com/a/66471626 supported} by OpenAPI Generator. 48 - */ 49 - 'x-enum-descriptions'?: ReadonlyArray<string>; 50 - /** 51 - * `x-enum-varnames` are {@link https://stackoverflow.com/a/66471626 supported} by OpenAPI Generator. 52 - */ 53 - 'x-enum-varnames'?: ReadonlyArray<string>; 54 - /** 55 - * {@link https://github.com/RicoSuter/NSwag NSwag} generates `x-enumNames` field containing custom enum names. 56 - */ 57 - 'x-enumNames'?: ReadonlyArray<string>; 58 - } 59 - 60 - /** 61 - * OpenAPI Specification Extensions. 62 - * 63 - * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 64 - */ 65 - export interface OpenAPIExtensions { 66 - [extension: `x-${string}`]: unknown; 67 - }
+8
packages/spec-types/src/extensions/spec.ts
··· 1 + /** 2 + * Specification Extensions. 3 + * 4 + * See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 5 + */ 6 + export interface SpecExtensions { 7 + [extension: `x-${string}`]: unknown; 8 + }
+3 -6
packages/spec-types/src/index.ts
··· 1 - export type { 2 - CodeSampleObject, 3 - EnumExtensions, 4 - LinguistLanguages, 5 - OpenAPIExtensions, 6 - } from './extensions/openapi'; 1 + export type { CodeSampleObject, LinguistLanguages } from './extensions/code-samples'; 2 + export type { EnumExtensions } from './extensions/enum'; 3 + export type { SpecExtensions } from './extensions/spec'; 7 4 export type * as JSONSchemaDraft4 from './json-schema/draft-4'; 8 5 export type * as JSONSchemaDraft2020_12 from './json-schema/draft-2020-12'; 9 6 export * as JSONSchema from './json-schema/union';
+27 -35
packages/spec-types/src/json-schema/draft-2020-12/spec.ts
··· 1 1 import type { AnyString, MaybeArray } from '@hey-api/types'; 2 2 3 - import type { EnumExtensions, OpenAPIExtensions } from '../../extensions/openapi'; 4 - import type { OpenAPIV3_1SchemaExtensions } from '../../openapi/v3-1/extensions'; 5 - 6 3 // TODO: left out some keywords related to structuring a complex schema and declaring a dialect 7 - export interface Document 8 - extends 9 - ArrayKeywords, 10 - NumberKeywords, 11 - ObjectKeywords, 12 - StringKeywords, 13 - EnumExtensions, 14 - OpenAPIV3_1SchemaExtensions, 15 - OpenAPIExtensions { 4 + export interface BaseDocument<TDocument = unknown> 5 + extends ArrayKeywords<TDocument>, NumberKeywords, ObjectKeywords<TDocument>, StringKeywords { 16 6 /** 17 7 * 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. 18 8 */ ··· 30 20 * 31 21 * {@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. 32 22 */ 33 - allOf?: ReadonlyArray<Document>; 23 + allOf?: Array<TDocument>; 34 24 /** 35 25 * `anyOf`: (OR) Must be valid against _any_ of the subschemas 36 26 * 37 27 * To validate against `anyOf`, the given data must be valid against any (one or more) of the given subschemas. 38 28 */ 39 - anyOf?: ReadonlyArray<Document>; 29 + anyOf?: Array<TDocument>; 40 30 /** 41 31 * The `const` keyword is used to restrict a value to a single value. 42 32 */ ··· 62 52 /** 63 53 * The `dependentRequired` {@link https://json-schema.org/learn/glossary#keyword keyword} conditionally requires that certain properties must be present if a given property is present in an object. For example, suppose we have a {@link https://json-schema.org/learn/glossary#schema schema} representing a customer. If you have their credit card number, you also want to ensure you have a billing address. If you don't have their credit card number, a billing address would not be required. We represent this dependency of one property on another using the `dependentRequired` keyword. The value of the `dependentRequired` keyword is an object. Each entry in the object maps from the name of a property, _p_, to an array of strings listing properties that are required if _p_ is present. 64 54 */ 65 - dependentRequired?: Record<string, ReadonlyArray<string>>; 55 + dependentRequired?: Record<string, Array<string>>; 66 56 /** 67 57 * 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. 68 58 */ 69 - dependentSchemas?: Record<string, Document>; 59 + dependentSchemas?: Record<string, TDocument>; 70 60 /** 71 61 * 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. 72 62 */ ··· 84 74 * 85 75 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored. 86 76 */ 87 - else?: Document; 77 + else?: TDocument; 88 78 /** 89 79 * 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. 90 80 * 91 81 * You can use `enum` even without a type, to accept values of different types. 92 82 */ 93 - enum?: ReadonlyArray<unknown>; 83 + enum?: Array<unknown>; 94 84 /** 95 85 * The `examples` keyword is a place to provide an array of examples that validate against the schema. This isn't used for validation, but may help with explaining the effect and purpose of the schema to a reader. Each entry should validate against the schema in which it resides, but that isn't strictly required. There is no need to duplicate the `default` value in the `examples` array, since `default` will be treated as another example. 96 86 */ 97 - examples?: ReadonlyArray<unknown>; 87 + examples?: Array<unknown>; 98 88 /** 99 89 * The `format` keyword allows for basic semantic identification of certain kinds of string values that are commonly used. For example, because JSON doesn't have a "DateTime" type, dates need to be encoded as strings. `format` allows the schema author to indicate that the string value should be interpreted as a date. By default, `format` is just an annotation and does not effect validation. 100 90 * ··· 112 102 * 113 103 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored. 114 104 */ 115 - if?: Document; 105 + if?: TDocument; 116 106 /** 117 107 * `not`: (NOT) Must _not_ be valid against the given schema 118 108 * 119 109 * The `not` keyword declares that an instance validates if it doesn't validate against the given subschema. 120 110 */ 121 - not?: Document; 111 + not?: TDocument; 122 112 /** 123 113 * `oneOf`: (XOR) Must be valid against _exactly one_ of the subschemas 124 114 * ··· 126 116 * 127 117 * 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. 128 118 */ 129 - oneOf?: ReadonlyArray<Document>; 119 + oneOf?: Array<TDocument>; 130 120 /** 131 121 * 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. 132 122 */ ··· 140 130 * 141 131 * If `then` and/or `else` appear in a schema without `if`, `then` and `else` are ignored. 142 132 */ 143 - then?: Document; 133 + then?: TDocument; 144 134 /** 145 135 * 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. 146 136 */ ··· 155 145 writeOnly?: boolean; 156 146 } 157 147 158 - export interface ArrayKeywords { 148 + export type Document = BaseDocument<Document>; 149 + 150 + export interface ArrayKeywords<TDocument = unknown> { 159 151 /** 160 152 * 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. 161 153 */ 162 - contains?: Document; 154 + contains?: TDocument; 163 155 /** 164 156 * 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. 165 157 * ··· 167 159 * 168 160 * 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}. 169 161 */ 170 - items?: Document | false; 162 + items?: TDocument | false; 171 163 /** 172 164 * `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. 173 165 */ ··· 187 179 /** 188 180 * `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. 189 181 */ 190 - prefixItems?: ReadonlyArray<Document>; 182 + prefixItems?: Array<TDocument>; 191 183 /** 192 184 * The `unevaluatedItems` keyword is useful mainly when you want to add or disallow extra items to an array. 193 185 * ··· 197 189 * 198 190 * Like with `items`, if you set `unevaluatedItems` to false, you can disallow extra items in the array. 199 191 */ 200 - unevaluatedItems?: Document | false; 192 + unevaluatedItems?: TDocument | false; 201 193 /** 202 194 * A schema can ensure that each of the items in an array is unique. Simply set the `uniqueItems` keyword to `true`. 203 195 */ ··· 271 263 multipleOf?: number; 272 264 } 273 265 274 - export interface ObjectKeywords { 266 + export interface ObjectKeywords<TDocument = unknown> { 275 267 /** 276 268 * 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. 277 269 * ··· 279 271 * 280 272 * 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}. 281 273 */ 282 - additionalProperties?: Document | false; 274 + additionalProperties?: TDocument | false; 283 275 /** 284 276 * 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. 285 277 */ ··· 291 283 /** 292 284 * 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. 293 285 */ 294 - patternProperties?: Record<string, Document>; 286 + patternProperties?: Record<string, TDocument>; 295 287 /** 296 288 * 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. 297 289 */ 298 - properties?: Record<string, Document | true>; 290 + properties?: Record<string, TDocument | true>; 299 291 /** 300 292 * 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. 301 293 * ··· 305 297 * { "type": "string" } 306 298 * ``` 307 299 */ 308 - propertyNames?: Document; 300 + propertyNames?: TDocument; 309 301 /** 310 302 * 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. 311 303 * 312 304 * The `required` keyword takes an array of zero or more strings. Each of these strings must be unique. 313 305 */ 314 - required?: ReadonlyArray<string>; 306 + required?: Array<string>; 315 307 /** 316 308 * The `unevaluatedProperties` keyword is similar to `additionalProperties` except that it can recognize properties declared in subschemas. So, the example from the previous section can be rewritten without the need to redeclare properties. 317 309 * 318 310 * `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. 319 311 */ 320 - unevaluatedProperties?: Document | false; 312 + unevaluatedProperties?: TDocument | false; 321 313 } 322 314 323 315 export interface StringKeywords {
+3 -5
packages/spec-types/src/json-schema/draft-4/spec.ts
··· 1 1 import type { AnyString } from '@hey-api/types'; 2 2 3 - import type { EnumExtensions } from '../../extensions/openapi'; 4 - 5 - export interface Document extends EnumExtensions { 3 + export interface Document { 6 4 /** 7 5 * A schema can reference another schema using the `$ref` keyword. The value of `$ref` is a URI-reference that is resolved against the schema's {@link https://json-schema.org/understanding-json-schema/structuring#base-uri Base URI}. When evaluating a `$ref`, an implementation uses the resolved identifier to retrieve the referenced schema and applies that schema to the {@link https://json-schema.org/learn/glossary#instance instance}. 8 6 * ··· 22 20 * 23 21 * You can use `enum` even without a type, to accept values of different types. 24 22 */ 25 - enum?: ReadonlyArray<unknown>; 23 + enum?: Array<unknown>; 26 24 /** 27 25 * Ranges of numbers are specified using a combination of the `minimum` and `maximum` keywords, (or `exclusiveMinimum` and `exclusiveMaximum` for expressing exclusive range). 28 26 * ··· 128 126 * 129 127 * The `required` keyword takes an array of zero or more strings. Each of these strings must be unique. 130 128 */ 131 - required?: ReadonlyArray<string>; 129 + required?: Array<string>; 132 130 /** 133 131 * 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. 134 132 */
+24 -22
packages/spec-types/src/openapi/v2/spec.ts
··· 1 - import type { CodeSampleObject, EnumExtensions } from '../../extensions/openapi'; 2 - import type { Document as JSONSchemaDraft4 } from '../../json-schema/draft-4/spec'; 1 + import type { CodeSampleObject } from '../../extensions/code-samples'; 2 + import type { EnumExtensions } from '../../extensions/enum'; 3 + import type { Document as JSONSchemaDraft4 } from '../../json-schema/draft-4'; 3 4 import type { OpenAPIV2NullableExtensions } from './extensions'; 4 5 5 6 /** ··· 17 18 /** 18 19 * A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#mime-types Mime Types}. 19 20 */ 20 - consumes?: ReadonlyArray<string>; 21 + consumes?: Array<string>; 21 22 /** 22 23 * An object to hold data types produced and consumed by operations. 23 24 */ ··· 45 46 /** 46 47 * A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#mime-types Mime Types}. 47 48 */ 48 - produces?: ReadonlyArray<string>; 49 + produces?: Array<string>; 49 50 /** 50 51 * An object to hold responses that can be used across operations. This property _does not_ define global responses for all operations. 51 52 */ ··· 53 54 /** 54 55 * The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the Swagger definition itself. 55 56 */ 56 - schemes?: ReadonlyArray<'http' | 'https' | 'ws' | 'wss'>; 57 + schemes?: Array<'http' | 'https' | 'ws' | 'wss'>; 57 58 /** 58 59 * A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. 59 60 */ 60 - security?: ReadonlyArray<SecurityRequirementObject>; 61 + security?: Array<SecurityRequirementObject>; 61 62 /** 62 63 * Security scheme definitions that can be used across the specification. 63 64 */ ··· 65 66 /** 66 67 * **Required**. Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`. 67 68 */ 68 - swagger: string; 69 + swagger: '2.0'; 69 70 /** 70 71 * A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-object Operation Object} must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. 71 72 */ 72 - tags?: ReadonlyArray<TagObject>; 73 + tags?: Array<TagObject>; 73 74 } 74 75 75 76 /** ··· 219 220 /** 220 221 * See {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1}. 221 222 */ 222 - enum?: ReadonlyArray<unknown>; 223 + enum?: Array<unknown>; 223 224 /** 224 225 * See {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2}. 225 226 */ ··· 401 402 /** 402 403 * See {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1}. 403 404 */ 404 - enum?: ReadonlyArray<unknown>; 405 + enum?: Array<unknown>; 405 406 /** 406 407 * See {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2}. 407 408 */ ··· 534 535 /** 535 536 * A list of MIME types the operation can consume. This overrides the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#swaggerConsumes `consumes`} definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#mime-types Mime Types}. 536 537 */ 537 - consumes?: ReadonlyArray<string>; 538 + consumes?: Array<string>; 538 539 /** 539 540 * Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`. 540 541 */ ··· 554 555 /** 555 556 * A list of parameters that are applicable for this operation. If a parameter is already defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#pathItemParameters Path Item}, the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterName name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterIn location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object Reference Object} to link to parameters that are defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#swaggerParameters Swagger Object's parameters}. There can be one "body" parameter at most. 556 557 */ 557 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 558 + parameters?: Array<ParameterObject | ReferenceObject>; 558 559 /** 559 560 * A list of MIME types the operation can produce. This overrides the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#swaggerProduces `produces`} definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#mime-types Mime Types}. 560 561 */ 561 - produces?: ReadonlyArray<string>; 562 + produces?: Array<string>; 562 563 /** 563 564 * **Required**. The list of possible responses as they are returned from executing this operation. 564 565 */ ··· 566 567 /** 567 568 * The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the Swagger Object {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#swaggerSchemes `schemes`} definition. 568 569 */ 569 - schemes?: ReadonlyArray<'http' | 'https' | 'ws' | 'wss'>; 570 + schemes?: Array<'http' | 'https' | 'ws' | 'wss'>; 570 571 /** 571 572 * A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#swaggerSecurity `security`}. To remove a top-level security declaration, an empty array can be used. 572 573 */ 573 - security?: ReadonlyArray<SecurityRequirementObject>; 574 + security?: Array<SecurityRequirementObject>; 574 575 /** 575 576 * A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. 576 577 */ ··· 578 579 /** 579 580 * A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. 580 581 */ 581 - tags?: ReadonlyArray<string>; 582 + tags?: Array<string>; 582 583 /** 583 584 * A list of code samples associated with an operation. 584 585 */ 585 - 'x-codeSamples'?: ReadonlyArray<CodeSampleObject>; 586 + 'x-codeSamples'?: Array<CodeSampleObject>; 586 587 } 587 588 588 589 /** ··· 739 740 /** 740 741 * See {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1}. 741 742 */ 742 - enum?: ReadonlyArray<unknown>; 743 + enum?: Array<unknown>; 743 744 /** 744 745 * See {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2}. 745 746 */ ··· 897 898 /** 898 899 * A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterName name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterIn location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object Reference Object} to link to parameters that are defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#swaggerParameters Swagger Object's parameters}. There can be one "body" parameter at most. 899 900 */ 900 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 901 + parameters?: Array<ParameterObject | ReferenceObject>; 901 902 /** 902 903 * A definition of a PATCH operation on this path. 903 904 */ ··· 1306 1307 * - packSize 1307 1308 * ``` 1308 1309 */ 1309 - export interface SchemaObject extends JSONSchemaDraft4, OpenAPIV2NullableExtensions { 1310 + export interface SchemaObject 1311 + extends JSONSchemaDraft4, EnumExtensions, OpenAPIV2NullableExtensions { 1310 1312 /** 1311 1313 * Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#specification-extensions Vendor Extensions} for further details. 1312 1314 */ ··· 1326 1328 * 1327 1329 * {@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. 1328 1330 */ 1329 - allOf?: ReadonlyArray<SchemaObject>; 1331 + allOf?: Array<SchemaObject>; 1330 1332 /** 1331 1333 * Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it. 1332 1334 */ ··· 1441 1443 /** 1442 1444 * Each name must correspond to a security scheme which is declared in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#securityDefinitions Security Definitions}. If the security scheme is of type `"oauth2"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. 1443 1445 */ 1444 - [name: string]: ReadonlyArray<string>; 1446 + [name: string]: Array<string>; 1445 1447 } 1446 1448 1447 1449 /**
+49 -41
packages/spec-types/src/openapi/v3-1/spec.ts
··· 1 - import type { CodeSampleObject, OpenAPIExtensions } from '../../extensions/openapi'; 2 - import type { Document as JSONSchemaDraft2020_12 } from '../../json-schema/draft-2020-12'; 1 + import type { CodeSampleObject } from '../../extensions/code-samples'; 2 + import type { EnumExtensions } from '../../extensions/enum'; 3 + import type { SpecExtensions } from '../../extensions/spec'; 4 + import type { BaseDocument as JSONSchemaDraft2020_12 } from '../../json-schema/draft-2020-12'; 5 + import type { OpenAPIV3_1SchemaExtensions } from './extensions'; 3 6 4 7 /** 5 8 * 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}. 6 9 * 7 10 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 8 11 */ 9 - export interface Document extends OpenAPIExtensions { 12 + export interface Document extends SpecExtensions { 10 13 /** 11 14 * An element to hold various schemas for the document. 12 15 */ ··· 34 37 /** 35 38 * A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array. 36 39 */ 37 - security?: ReadonlyArray<SecurityRequirementObject>; 40 + security?: Array<SecurityRequirementObject>; 38 41 /** 39 42 * An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object Server Object} with a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverUrl url} value of `/`. 40 43 */ 41 - servers?: ReadonlyArray<ServerObject>; 44 + servers?: Array<ServerObject>; 42 45 /** 43 46 * A list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object} must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. 44 47 */ 45 - tags?: ReadonlyArray<TagObject>; 48 + tags?: Array<TagObject>; 46 49 /** 47 50 * The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An {@link https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.yaml example} is available. 48 51 */ ··· 130 133 * description: callback successfully processed 131 134 * ``` 132 135 */ 133 - export interface CallbackObject extends OpenAPIExtensions { 136 + export interface CallbackObject extends SpecExtensions { 134 137 /** 135 138 * 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. 136 139 */ ··· 226 229 * read:pets: read your pets 227 230 * ``` 228 231 */ 229 - export interface ComponentsObject extends OpenAPIExtensions { 232 + export interface ComponentsObject extends SpecExtensions { 230 233 /** 231 234 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}. 232 235 */ ··· 281 284 * email: support@example.com 282 285 * ``` 283 286 */ 284 - export interface ContactObject extends OpenAPIExtensions { 287 + export interface ContactObject extends SpecExtensions { 285 288 /** 286 289 * The email address of the contact person/organization. This MUST be in the form of an email address. 287 290 */ ··· 422 425 * 423 426 * will map to `Dog` because of the definition in the `mapping` element. 424 427 */ 425 - export interface DiscriminatorObject extends OpenAPIExtensions { 428 + export interface DiscriminatorObject extends SpecExtensions { 426 429 /** 427 430 * An object to hold mappings between payload values and schema names or references. 428 431 */ ··· 474 477 * type: integer 475 478 * ``` 476 479 */ 477 - export interface EncodingObject extends OpenAPIExtensions { 480 + export interface EncodingObject extends SpecExtensions { 478 481 /** 479 482 * 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. 480 483 */ ··· 570 573 * $ref: '#/components/examples/confirmation-success' 571 574 * ``` 572 575 */ 573 - export interface ExampleObject extends OpenAPIExtensions { 576 + export interface ExampleObject extends SpecExtensions { 574 577 /** 575 578 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 576 579 */ ··· 600 603 * url: https://example.com 601 604 * ``` 602 605 */ 603 - export interface ExternalDocumentationObject extends OpenAPIExtensions { 606 + export interface ExternalDocumentationObject extends SpecExtensions { 604 607 /** 605 608 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 606 609 */ ··· 648 651 * version: 1.0.1 649 652 * ``` 650 653 */ 651 - export interface InfoObject extends OpenAPIExtensions { 654 + export interface InfoObject extends SpecExtensions { 652 655 /** 653 656 * The contact information for the exposed API. 654 657 */ ··· 690 693 * identifier: Apache-2.0 691 694 * ``` 692 695 */ 693 - export interface LicenseObject extends OpenAPIExtensions { 696 + export interface LicenseObject extends SpecExtensions { 694 697 /** 695 698 * An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field. 696 699 */ ··· 852 855 * 853 856 * Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. 854 857 */ 855 - export interface LinkObject extends OpenAPIExtensions { 858 + export interface LinkObject extends SpecExtensions { 856 859 /** 857 860 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 858 861 */ ··· 912 915 * $ref: "#/components/examples/frog-example" 913 916 * ``` 914 917 */ 915 - export interface MediaTypeObject extends OpenAPIExtensions { 918 + export interface MediaTypeObject extends SpecExtensions { 916 919 /** 917 920 * 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`. 918 921 */ ··· 954 957 * read:pets: read your pets 955 958 * ``` 956 959 */ 957 - export interface OAuthFlowObject extends OpenAPIExtensions { 960 + export interface OAuthFlowObject extends SpecExtensions { 958 961 /** 959 962 * **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. 960 963 */ ··· 978 981 * 979 982 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 980 983 */ 981 - export interface OAuthFlowsObject extends OpenAPIExtensions { 984 + export interface OAuthFlowsObject extends SpecExtensions { 982 985 /** 983 986 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 984 987 */ ··· 1046 1049 * - read:pets 1047 1050 * ``` 1048 1051 */ 1049 - export interface OperationObject extends OpenAPIExtensions { 1052 + export interface OperationObject extends SpecExtensions { 1050 1053 /** 1051 1054 * 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 1055 */ ··· 1070 1073 /** 1071 1074 * A list of parameters that are applicable for this operation. If a parameter is already defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemParameters Path Item}, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterName name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object Reference Object} to link to parameters that are defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsParameters OpenAPI Object's components/parameters}. 1072 1075 */ 1073 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 1076 + parameters?: Array<ParameterObject | ReferenceObject>; 1074 1077 /** 1075 1078 * The request body applicable for this operation. The `requestBody` is fully supported in HTTP methods where the HTTP 1.1 specification {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1 RFC7231} has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1 GET}, {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.2 HEAD} and {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.5 DELETE}), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible. 1076 1079 */ ··· 1082 1085 /** 1083 1086 * A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasSecurity `security`}. To remove a top-level security declaration, an empty array can be used. 1084 1087 */ 1085 - security?: ReadonlyArray<SecurityRequirementObject>; 1088 + security?: Array<SecurityRequirementObject>; 1086 1089 /** 1087 1090 * An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. 1088 1091 */ 1089 - servers?: ReadonlyArray<ServerObject>; 1092 + servers?: Array<ServerObject>; 1090 1093 /** 1091 1094 * A short summary of what the operation does. 1092 1095 */ ··· 1094 1097 /** 1095 1098 * A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. 1096 1099 */ 1097 - tags?: ReadonlyArray<string>; 1100 + tags?: Array<string>; 1098 1101 /** 1099 1102 * A list of code samples associated with an operation. 1100 1103 */ 1101 - 'x-codeSamples'?: ReadonlyArray<CodeSampleObject>; 1104 + 'x-codeSamples'?: Array<CodeSampleObject>; 1102 1105 } 1103 1106 1104 1107 /** ··· 1198 1201 * type: number 1199 1202 * ``` 1200 1203 */ 1201 - export interface ParameterObject extends OpenAPIExtensions { 1204 + export interface ParameterObject extends SpecExtensions { 1202 1205 /** 1203 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. 1204 1207 */ ··· 1301 1304 * style: simple 1302 1305 * ``` 1303 1306 */ 1304 - export interface PathItemObject extends OpenAPIExtensions { 1307 + export interface PathItemObject extends SpecExtensions { 1305 1308 /** 1306 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}. 1307 1310 */ ··· 1329 1332 /** 1330 1333 * A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterName name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object Reference Object} to link to parameters that are defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsParameters OpenAPI Object's components/parameters}. 1331 1334 */ 1332 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 1335 + parameters?: Array<ParameterObject | ReferenceObject>; 1333 1336 /** 1334 1337 * A definition of a PATCH operation on this path. 1335 1338 */ ··· 1345 1348 /** 1346 1349 * An alternative `server` array to service all operations in this path. 1347 1350 */ 1348 - servers?: ReadonlyArray<ServerObject>; 1351 + servers?: Array<ServerObject>; 1349 1352 /** 1350 1353 * An optional, string summary, intended to apply to all operations in this path. 1351 1354 */ ··· 1401 1404 * $ref: '#/components/schemas/pet' 1402 1405 * ``` 1403 1406 */ 1404 - export interface PathsObject extends OpenAPIExtensions { 1407 + export interface PathsObject extends SpecExtensions { 1405 1408 /** 1406 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. 1407 1410 */ ··· 1506 1509 * type: string 1507 1510 * ``` 1508 1511 */ 1509 - export interface RequestBodyObject extends OpenAPIExtensions { 1512 + export interface RequestBodyObject extends SpecExtensions { 1510 1513 /** 1511 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/* 1512 1515 */ ··· 1582 1585 * description: object created 1583 1586 * ``` 1584 1587 */ 1585 - export interface ResponseObject extends OpenAPIExtensions { 1588 + export interface ResponseObject extends SpecExtensions { 1586 1589 /** 1587 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/* 1588 1591 */ ··· 1630 1633 * $ref: '#/components/schemas/ErrorModel' 1631 1634 * ``` 1632 1635 */ 1633 - export interface ResponsesObject extends OpenAPIExtensions { 1636 + export interface ResponsesObject extends SpecExtensions { 1634 1637 /** 1635 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. 1636 1639 */ ··· 1665 1668 * 1666 1669 * 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. 1667 1670 */ 1668 - export type SchemaObject = JSONSchemaDraft2020_12 & OpenAPIExtensions; 1671 + export interface SchemaObject 1672 + extends 1673 + JSONSchemaDraft2020_12<SchemaObject>, 1674 + OpenAPIV3_1SchemaExtensions, 1675 + SpecExtensions, 1676 + EnumExtensions {} 1669 1677 1670 1678 /** 1671 1679 * 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}. ··· 1705 1713 /** 1706 1714 * Each name MUST correspond to a security scheme which is 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}. If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution, and the list MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MAY contain a list of role names which are required for the execution, but are not otherwise defined or exchanged in-band. 1707 1715 */ 1708 - [name: string]: ReadonlyArray<string>; 1716 + [name: string]: Array<string>; 1709 1717 } 1710 1718 1711 1719 /** ··· 1752 1760 * read:pets: read your pets 1753 1761 * ``` 1754 1762 */ 1755 - export type SecuritySchemeObject = OpenAPIExtensions & { 1763 + export type SecuritySchemeObject = SpecExtensions & { 1756 1764 /** 1757 1765 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1758 1766 */ ··· 1825 1833 * description: Development server 1826 1834 * ``` 1827 1835 */ 1828 - export interface ServerObject extends OpenAPIExtensions { 1836 + export interface ServerObject extends SpecExtensions { 1829 1837 /** 1830 1838 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1831 1839 */ ··· 1845 1853 * 1846 1854 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 1847 1855 */ 1848 - export interface ServerVariableObject extends OpenAPIExtensions { 1856 + export interface ServerVariableObject extends SpecExtensions { 1849 1857 /** 1850 1858 * **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. 1851 1859 */ ··· 1857 1865 /** 1858 1866 * An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty. 1859 1867 */ 1860 - enum?: ReadonlyArray<string>; 1868 + enum?: Array<string>; 1861 1869 } 1862 1870 1863 1871 /** ··· 1871 1879 * description: Pets operations 1872 1880 * ``` 1873 1881 */ 1874 - export interface TagObject extends OpenAPIExtensions { 1882 + export interface TagObject extends SpecExtensions { 1875 1883 /** 1876 1884 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1877 1885 */ ··· 2078 2086 * </aliens> 2079 2087 * ``` 2080 2088 */ 2081 - export interface XMLObject extends OpenAPIExtensions { 2089 + export interface XMLObject extends SpecExtensions { 2082 2090 /** 2083 2091 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 2084 2092 */
+46 -44
packages/spec-types/src/openapi/v3/spec.ts
··· 1 - import type { CodeSampleObject, EnumExtensions, OpenAPIExtensions } from '../../extensions/openapi'; 1 + import type { CodeSampleObject } from '../../extensions/code-samples'; 2 + import type { EnumExtensions } from '../../extensions/enum'; 3 + import type { SpecExtensions } from '../../extensions/spec'; 2 4 3 5 /** 4 6 * 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 7 * 6 8 * 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 9 */ 8 - export interface Document extends OpenAPIExtensions { 10 + export interface Document extends SpecExtensions { 9 11 /** 10 12 * An element to hold various Objects for the OpenAPI Description. 11 13 */ ··· 29 31 /** 30 32 * A declaration of which security mechanisms can be used across the API. The list of values includes alternative Security Requirement Objects that can be used. Only one of the Security Requirement Objects need to be satisfied to authorize a request. Individual operations can override this definition. The list can be incomplete, up to being empty or absent. To make security explicitly optional, an empty security requirement (`{}`) can be included in the array. 31 33 */ 32 - security?: ReadonlyArray<SecurityRequirementObject>; 34 + security?: Array<SecurityRequirementObject>; 33 35 /** 34 36 * An array of Server Objects, which provide connectivity information to a target server. If the `servers` field is not provided, or is an empty array, the default value would be a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#server-object Server Object} with a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#server-url url} value of `/`. 35 37 */ 36 - servers?: ReadonlyArray<ServerObject>; 38 + servers?: Array<ServerObject>; 37 39 /** 38 40 * A list of tags used by the OpenAPI Description with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#operation-object Operation Object} must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. 39 41 */ 40 - tags?: ReadonlyArray<TagObject>; 42 + tags?: Array<TagObject>; 41 43 } 42 44 43 45 /** ··· 47 49 * 48 50 * TODO: examples 49 51 */ 50 - export interface CallbackObject extends OpenAPIExtensions { 52 + export interface CallbackObject extends SpecExtensions { 51 53 /** 52 54 * 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 55 */ ··· 63 65 * 64 66 * TODO: examples 65 67 */ 66 - export interface ComponentsObject extends OpenAPIExtensions { 68 + export interface ComponentsObject extends SpecExtensions { 67 69 /** 68 70 * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#callback-object Callback Objects}. 69 71 */ ··· 113 115 * email: support@example.com 114 116 * ``` 115 117 */ 116 - export interface ContactObject extends OpenAPIExtensions { 118 + export interface ContactObject extends SpecExtensions { 117 119 /** 118 120 * The email address of the contact person/organization. This MUST be in the form of an email address. 119 121 */ ··· 160 162 * TODO: default values examples 161 163 * TODO: examples 162 164 */ 163 - export interface EncodingObject extends OpenAPIExtensions { 165 + export interface EncodingObject extends SpecExtensions { 164 166 /** 165 167 * 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 168 */ ··· 201 203 * 202 204 * TODO: examples 203 205 */ 204 - export interface ExampleObject extends OpenAPIExtensions { 206 + export interface ExampleObject extends SpecExtensions { 205 207 /** 206 208 * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 207 209 */ ··· 232 234 * url: https://example.com 233 235 * ``` 234 236 */ 235 - export interface ExternalDocumentationObject extends OpenAPIExtensions { 237 + export interface ExternalDocumentationObject extends SpecExtensions { 236 238 /** 237 239 * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 238 240 */ ··· 276 278 * version: 1.0.1 277 279 * ``` 278 280 */ 279 - export interface InfoObject extends OpenAPIExtensions { 281 + export interface InfoObject extends SpecExtensions { 280 282 /** 281 283 * The contact information for the exposed API. 282 284 */ ··· 313 315 * url: https://www.apache.org/licenses/LICENSE-2.0.html 314 316 * ``` 315 317 */ 316 - export interface LicenseObject extends OpenAPIExtensions { 318 + export interface LicenseObject extends SpecExtensions { 317 319 /** 318 320 * **REQUIRED**. The license name used for the API. 319 321 */ ··· 339 341 * 340 342 * TODO: examples 341 343 */ 342 - export interface LinkObject extends OpenAPIExtensions { 344 + export interface LinkObject extends SpecExtensions { 343 345 /** 344 346 * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 345 347 */ ··· 375 377 * 376 378 * TODO: examples 377 379 */ 378 - export interface MediaTypeObject extends OpenAPIExtensions { 380 + export interface MediaTypeObject extends SpecExtensions { 379 381 /** 380 382 * 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 383 */ ··· 401 403 * 402 404 * TODO: examples 403 405 */ 404 - export interface OAuthFlowObject extends OpenAPIExtensions { 406 + export interface OAuthFlowObject extends SpecExtensions { 405 407 /** 406 408 * **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 409 */ ··· 425 427 * 426 428 * 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 429 */ 428 - export interface OAuthFlowsObject extends OpenAPIExtensions { 430 + export interface OAuthFlowsObject extends SpecExtensions { 429 431 /** 430 432 * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. 431 433 */ ··· 451 453 * 452 454 * TODO: examples 453 455 */ 454 - export interface OperationObject extends OpenAPIExtensions { 456 + export interface OperationObject extends SpecExtensions { 455 457 /** 456 458 * 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. 457 459 */ ··· 475 477 /** 476 478 * A list of parameters that are applicable for this operation. If a parameter is already defined in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#path-item-parameters Path Item}, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#parameter-name name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#parameter-in location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#reference-object Reference Object} to link to parameters that are defined in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#components-parameters OpenAPI Object's `components.parameters`}. 477 479 */ 478 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 480 + parameters?: Array<ParameterObject | ReferenceObject>; 479 481 /** 480 482 * The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification {@link https://tools.ietf.org/html/rfc7231#section-4.3.1 RFC7231} has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as {@link https://tools.ietf.org/html/rfc7231#section-4.3.1 GET}, {@link https://tools.ietf.org/html/rfc7231#section-4.3.2 HEAD} and {@link https://tools.ietf.org/html/rfc7231#section-4.3.5 DELETE}), `requestBody` SHALL be ignored by consumers. 481 483 */ ··· 487 489 /** 488 490 * A declaration of which security mechanisms can be used for this operation. The list of values includes alternative Security Requirement Objects that can be used. Only one of the Security Requirement Objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#oas-security `security`}. To remove a top-level security declaration, an empty array can be used. 489 491 */ 490 - security?: ReadonlyArray<SecurityRequirementObject>; 492 + security?: Array<SecurityRequirementObject>; 491 493 /** 492 494 * An alternative `servers` array to service this operation. If a `servers` array is specified at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#path-item-servers Path Item Object} or {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#oas-servers OpenAPI Object} level, it will be overridden by this value. 493 495 */ 494 - servers?: ReadonlyArray<ServerObject>; 496 + servers?: Array<ServerObject>; 495 497 /** 496 498 * A short summary of what the operation does. 497 499 */ ··· 499 501 /** 500 502 * A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. 501 503 */ 502 - tags?: ReadonlyArray<string>; 504 + tags?: Array<string>; 503 505 /** 504 506 * A list of code samples associated with an operation. 505 507 */ 506 - 'x-codeSamples'?: ReadonlyArray<CodeSampleObject>; 508 + 'x-codeSamples'?: Array<CodeSampleObject>; 507 509 } 508 510 509 511 /** ··· 550 552 * 551 553 * TODO: examples 552 554 */ 553 - export interface ParameterObject extends OpenAPIExtensions { 555 + export interface ParameterObject extends SpecExtensions { 554 556 /** 555 557 * 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. 556 558 */ ··· 622 624 * 623 625 * TODO: examples 624 626 */ 625 - export interface PathItemObject extends OpenAPIExtensions { 627 + export interface PathItemObject extends SpecExtensions { 626 628 /** 627 629 * 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}. 628 630 */ ··· 650 652 /** 651 653 * A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#parameter-name name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#parameter-in location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#reference-object Reference Object} to link to parameters that are defined in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#components-parameters OpenAPI Object's `components.parameters`}. 652 654 */ 653 - parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 655 + parameters?: Array<ParameterObject | ReferenceObject>; 654 656 /** 655 657 * A definition of a PATCH operation on this path. 656 658 */ ··· 666 668 /** 667 669 * An alternative `servers` array to service all operations in this path. If a `servers` array is specified at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#oas-servers OpenAPI Object} level, it will be overridden by this value. 668 670 */ 669 - servers?: ReadonlyArray<ServerObject>; 671 + servers?: Array<ServerObject>; 670 672 /** 671 673 * An optional string summary, intended to apply to all operations in this path. 672 674 */ ··· 684 686 * 685 687 * TODO: examples 686 688 */ 687 - export interface PathsObject extends OpenAPIExtensions { 689 + export interface PathsObject extends SpecExtensions { 688 690 /** 689 691 * 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. 690 692 */ ··· 732 734 * 733 735 * TODO: examples 734 736 */ 735 - export interface RequestBodyObject extends OpenAPIExtensions { 737 + export interface RequestBodyObject extends SpecExtensions { 736 738 /** 737 739 * **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/*"` 738 740 */ ··· 754 756 * 755 757 * TODO: examples 756 758 */ 757 - export interface ResponseObject extends OpenAPIExtensions { 759 + export interface ResponseObject extends SpecExtensions { 758 760 /** 759 761 * 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/*"` 760 762 */ ··· 786 788 * 787 789 * TODO: examples 788 790 */ 789 - export interface ResponsesObject extends OpenAPIExtensions { 791 + export interface ResponsesObject extends SpecExtensions { 790 792 /** 791 793 * 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. 792 794 */ ··· 848 850 * 849 851 * TODO: content, examples 850 852 */ 851 - export interface SchemaObject extends EnumExtensions, OpenAPIExtensions { 853 + export interface SchemaObject extends EnumExtensions, SpecExtensions { 852 854 /** 853 855 * The value of "additionalProperties" MUST be a boolean or a schema. 854 856 * ··· 870 872 * 871 873 * An instance validates successfully against this keyword if it validates successfully against all schemas defined by this keyword's value. 872 874 */ 873 - allOf?: ReadonlyArray<SchemaObject | ReferenceObject>; 875 + allOf?: Array<SchemaObject | ReferenceObject>; 874 876 /** 875 877 * This keyword's value MUST be an array. This array MUST have at least one element. 876 878 * ··· 879 881 * An instance validates successfully against this keyword if it validates successfully against at least one schema defined by this 880 882 keyword's value. 881 883 */ 882 - anyOf?: ReadonlyArray<SchemaObject | ReferenceObject>; 884 + anyOf?: Array<SchemaObject | ReferenceObject>; 883 885 /** 884 886 * The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined `type` for the Schema Object defined at the same level. For example, if `type` is `"string"`, then `default` can be `"foo"` but cannot be `1`. 885 887 */ ··· 907 909 * 908 910 * An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value. 909 911 */ 910 - enum?: ReadonlyArray<unknown>; 912 + enum?: Array<unknown>; 911 913 /** 912 914 * A free-form field to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. 913 915 */ ··· 1019 1021 * 1020 1022 * An instance validates successfully against this keyword if it validates successfully against exactly one schema defined by this keyword's value. 1021 1023 */ 1022 - oneOf?: ReadonlyArray<SchemaObject | ReferenceObject>; 1024 + oneOf?: Array<SchemaObject | ReferenceObject>; 1023 1025 /** 1024 1026 * The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. 1025 1027 * ··· 1041 1043 * 1042 1044 * An object instance is valid against this keyword if its property set contains all elements in this keyword's array value. 1043 1045 */ 1044 - required?: ReadonlyArray<string>; 1046 + required?: Array<string>; 1045 1047 /** 1046 1048 * The value of both of these keywords MUST be a string. 1047 1049 * ··· 1089 1091 /** 1090 1092 * Each name MUST correspond to a security scheme which is declared in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#security-scheme-object Security Schemes} under the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#components-object Components Object}. If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution, and the list MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MUST be empty. 1091 1093 */ 1092 - [name: string]: ReadonlyArray<string>; 1094 + [name: string]: Array<string>; 1093 1095 } 1094 1096 1095 1097 /** ··· 1101 1103 * 1102 1104 * TODO: examples 1103 1105 */ 1104 - export type SecuritySchemeObject = OpenAPIExtensions & { 1106 + export type SecuritySchemeObject = SpecExtensions & { 1105 1107 /** 1106 1108 * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1107 1109 */ ··· 1164 1166 * 1165 1167 * TODO: examples 1166 1168 */ 1167 - export interface ServerObject extends OpenAPIExtensions { 1169 + export interface ServerObject extends SpecExtensions { 1168 1170 /** 1169 1171 * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1170 1172 */ ··· 1184 1186 * 1185 1187 * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions Specification Extensions}. 1186 1188 */ 1187 - export interface ServerVariableObject extends OpenAPIExtensions { 1189 + export interface ServerVariableObject extends SpecExtensions { 1188 1190 /** 1189 1191 * **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. 1190 1192 */ ··· 1196 1198 /** 1197 1199 * An enumeration of string values to be used if the substitution options are from a limited set. The array SHOULD NOT be empty. 1198 1200 */ 1199 - enum?: ReadonlyArray<string>; 1201 + enum?: Array<string>; 1200 1202 } 1201 1203 1202 1204 /** ··· 1211 1213 * description: Pets operations 1212 1214 * ``` 1213 1215 */ 1214 - export interface TagObject extends OpenAPIExtensions { 1216 + export interface TagObject extends SpecExtensions { 1215 1217 /** 1216 1218 * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 1217 1219 */ ··· 1240 1242 * 1241 1243 * TODO: examples 1242 1244 */ 1243 - export interface XMLObject extends OpenAPIExtensions { 1245 + export interface XMLObject extends SpecExtensions { 1244 1246 /** 1245 1247 * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. 1246 1248 */
+2 -1
packages/spec-types/tsconfig.json
··· 6 6 "outDir": "dist", 7 7 "rootDir": "src" 8 8 }, 9 - "include": ["src"] 9 + "include": ["src"], 10 + "references": [{ "path": "../types" }] 10 11 }
+10
packages/spec-types/tsdown.config.ts
··· 1 + import { defineConfig } from 'tsdown'; 2 + 3 + export default defineConfig({ 4 + attw: { 5 + ignoreRules: ['cjs-resolves-to-esm'], 6 + profile: 'esm-only', 7 + }, 8 + publint: true, 9 + sourcemap: true, 10 + });
+10
packages/spec-types/turbo.json
··· 1 + { 2 + "$schema": "../../node_modules/turbo/schema.json", 3 + "extends": ["//"], 4 + "tasks": { 5 + "build": { 6 + "dependsOn": [], 7 + "outputs": ["dist/**"] 8 + } 9 + } 10 + }