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 #950 from hey-api/chore/perf-test

test: add a simple performance test

authored by

Lubos and committed by
GitHub
da958d1b 15be1212

+1052 -55
+1
packages/openapi-ts/src/generate/__tests__/class.spec.ts
··· 17 17 configFile: '', 18 18 debug: false, 19 19 dryRun: false, 20 + experimental_parser: false, 20 21 exportCore: true, 21 22 input: '', 22 23 name: 'AppClient',
+3
packages/openapi-ts/src/generate/__tests__/core.spec.ts
··· 32 32 configFile: '', 33 33 debug: false, 34 34 dryRun: false, 35 + experimental_parser: false, 35 36 exportCore: true, 36 37 input: '', 37 38 name: 'AppClient', ··· 92 93 configFile: '', 93 94 debug: false, 94 95 dryRun: false, 96 + experimental_parser: false, 95 97 exportCore: true, 96 98 input: '', 97 99 name: 'AppClient', ··· 135 137 configFile: '', 136 138 debug: false, 137 139 dryRun: false, 140 + experimental_parser: false, 138 141 exportCore: true, 139 142 input: '', 140 143 name: 'AppClient',
+1
packages/openapi-ts/src/generate/__tests__/index.spec.ts
··· 18 18 configFile: '', 19 19 debug: false, 20 20 dryRun: false, 21 + experimental_parser: false, 21 22 exportCore: true, 22 23 input: '', 23 24 output: {
+1
packages/openapi-ts/src/generate/__tests__/output.spec.ts
··· 17 17 configFile: '', 18 18 debug: false, 19 19 dryRun: false, 20 + experimental_parser: false, 20 21 exportCore: true, 21 22 input: '', 22 23 output: {
+1
packages/openapi-ts/src/generate/__tests__/schemas.spec.ts
··· 19 19 configFile: '', 20 20 debug: false, 21 21 dryRun: false, 22 + experimental_parser: false, 22 23 exportCore: true, 23 24 input: '', 24 25 name: 'AppClient',
+4
packages/openapi-ts/src/generate/__tests__/services.spec.ts
··· 20 20 configFile: '', 21 21 debug: false, 22 22 dryRun: false, 23 + experimental_parser: false, 23 24 exportCore: true, 24 25 input: '', 25 26 output: { ··· 140 141 configFile: '', 141 142 debug: false, 142 143 dryRun: false, 144 + experimental_parser: false, 143 145 exportCore: true, 144 146 input: '', 145 147 output: { ··· 182 184 configFile: '', 183 185 debug: false, 184 186 dryRun: false, 187 + experimental_parser: false, 185 188 exportCore: true, 186 189 input: '', 187 190 output: { ··· 227 230 configFile: '', 228 231 debug: false, 229 232 dryRun: false, 233 + experimental_parser: false, 230 234 exportCore: true, 231 235 input: '', 232 236 output: {
+1
packages/openapi-ts/src/generate/__tests__/types.spec.ts
··· 18 18 configFile: '', 19 19 debug: false, 20 20 dryRun: false, 21 + experimental_parser: false, 21 22 exportCore: true, 22 23 input: '', 23 24 name: 'AppClient',
+27 -8
packages/openapi-ts/src/index.ts
··· 11 11 import { getConfig, isStandaloneClient, setConfig } from './utils/config'; 12 12 import { getOpenApiSpec } from './utils/getOpenApiSpec'; 13 13 import { registerHandlebarTemplates } from './utils/handlebars'; 14 + import { Performance } from './utils/performance'; 14 15 import { postProcessClient } from './utils/postprocess'; 15 16 16 17 type OutputProcesser = { ··· 234 235 debug = false, 235 236 dryRun = false, 236 237 exportCore = true, 238 + experimental_parser = false, 237 239 input, 238 240 name, 239 241 request, ··· 279 281 configFile, 280 282 debug, 281 283 dryRun, 284 + experimental_parser, 282 285 exportCore: 283 286 isStandaloneClient(client) || !client.name ? false : exportCore, 284 287 input, ··· 301 304 * @param userConfig {@link UserConfig} passed to the `createClient()` method 302 305 */ 303 306 export async function createClient(userConfig: UserConfig): Promise<Client[]> { 307 + Performance.start('createClient'); 308 + 304 309 const configs = await initConfigs(userConfig); 305 310 306 - const createClientPromise = (config: Config) => async () => { 311 + const templates = registerHandlebarTemplates(); 312 + 313 + const pCreateClient = (config: Config) => async () => { 307 314 const openApi = 308 315 typeof config.input === 'string' 309 316 ? await getOpenApiSpec(config.input) ··· 311 318 ReturnType<typeof getOpenApiSpec> 312 319 >); 313 320 314 - const client = postProcessClient(parse(openApi)); 315 - const templates = registerHandlebarTemplates(); 321 + Performance.start('parser'); 322 + const parsed = parse(openApi); 323 + const client = postProcessClient(parsed); 324 + Performance.end('parser'); 325 + 326 + if (config.experimental_parser) { 327 + Performance.start('experimental_parser'); 328 + // TODO: experimental parser 329 + Performance.end('experimental_parser'); 330 + } 316 331 317 332 if (!config.dryRun) { 318 333 logClientMessage(); ··· 325 340 return client; 326 341 }; 327 342 328 - let clients: Client[] = []; 329 - const clientPromises = configs.map((config) => createClientPromise(config)); 330 - for (const clientPromise of clientPromises) { 331 - const client = await clientPromise(); 332 - clients = [...clients, client]; 343 + const clients: Client[] = []; 344 + 345 + const pClients = configs.map((config) => pCreateClient(config)); 346 + for (const pClient of pClients) { 347 + const client = await pClient(); 348 + clients.push(client); 333 349 } 350 + 351 + Performance.end('createClient'); 352 + 334 353 return clients; 335 354 } 336 355
+875
packages/openapi-ts/src/openApi/3.1/types/spec.ts
··· 1 + /** 2 + * 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}. 3 + * 4 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 5 + */ 6 + export interface OpenApiV3_1 { 7 + /** 8 + * An element to hold various schemas for the document. 9 + */ 10 + components?: any; 11 + /** 12 + * Additional external documentation. 13 + */ 14 + externalDocs?: ExternalDocumentationObject; 15 + /** 16 + * **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. 17 + */ 18 + info: InfoObject; 19 + /** 20 + * The default value for the `$schema` keyword within {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Objects} contained within this OAS document. This MUST be in the form of a URI. 21 + */ 22 + jsonSchemaDialect?: string; 23 + /** 24 + * **REQUIRED**. This string MUST be the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions version number} of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is _not_ related to the API {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion info.version} string. 25 + */ 26 + openapi: '3.1.0'; 27 + /** 28 + * The available paths and operations for the API. 29 + */ 30 + paths?: any; 31 + /** 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. To make security optional, an empty security requirement (`{}`) can be included in the array. 33 + */ 34 + security?: ReadonlyArray<SecurityRequirementObject>; 35 + /** 36 + * 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 `/`. 37 + */ 38 + servers?: ReadonlyArray<ServerObject>; 39 + /** 40 + * 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. 41 + */ 42 + tags?: ReadonlyArray<TagObject>; 43 + /** 44 + * 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. 45 + */ 46 + webhooks?: Record<string, PathItemObject | ReferenceObject>; 47 + } 48 + 49 + /** 50 + * Allows referencing an external resource for extended documentation. 51 + * 52 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 53 + * 54 + * @example 55 + * ```yaml 56 + * description: Find more info here 57 + * url: https://example.com 58 + * ``` 59 + */ 60 + interface ExternalDocumentationObject { 61 + /** 62 + * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 63 + */ 64 + description?: string; 65 + /** 66 + * **REQUIRED**. The URL for the target documentation. This MUST be in the form of a URL. 67 + */ 68 + url: string; 69 + } 70 + 71 + /** 72 + * The Header Object follows the structure of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object Parameter Object} with the following changes: 73 + * 74 + * 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 75 + * 1. `in` MUST NOT be specified, it is implicitly in `header`. 76 + * 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`}). 77 + * 78 + * @example 79 + * ```yaml 80 + * description: The number of allowed requests in the current period 81 + * schema: 82 + * type: integer 83 + * ``` 84 + */ 85 + interface HeaderObject extends Omit<ParameterObject, 'in' | 'name'> {} 86 + 87 + /** 88 + * The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. 89 + * 90 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 91 + * 92 + * @example 93 + * ```yaml 94 + * title: Sample Pet Store App 95 + * summary: A pet store manager. 96 + * description: This is a sample server for a pet store. 97 + * termsOfService: https://example.com/terms/ 98 + * contact: 99 + * name: API Support 100 + * url: https://www.example.com/support 101 + * email: support@example.com 102 + * license: 103 + * name: Apache 2.0 104 + * url: https://www.apache.org/licenses/LICENSE-2.0.html 105 + * version: 1.0.1 106 + * ``` 107 + */ 108 + interface InfoObject { 109 + /** 110 + * The contact information for the exposed API. 111 + */ 112 + contact?: ContactObject; 113 + /** 114 + * A description of the API. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 115 + */ 116 + description?: string; 117 + /** 118 + * The license information for the exposed API. 119 + */ 120 + license?: LicenseObject; 121 + /** 122 + * A short summary of the API. 123 + */ 124 + summary?: string; 125 + /** 126 + * A URL to the Terms of Service for the API. This MUST be in the form of a URL. 127 + */ 128 + termsOfService?: string; 129 + /** 130 + * **REQUIRED**. The title of the API. 131 + */ 132 + title: string; 133 + /** 134 + * **REQUIRED**. The version of the OpenAPI document (which is distinct from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasVersion OpenAPI Specification version} or the API implementation version). 135 + */ 136 + version: string; 137 + } 138 + 139 + /** 140 + * Contact information for the exposed API. 141 + * 142 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 143 + * 144 + * @example 145 + * ```yaml 146 + * name: API Support 147 + * url: https://www.example.com/support 148 + * email: support@example.com 149 + * ``` 150 + */ 151 + interface ContactObject { 152 + /** 153 + * The email address of the contact person/organization. This MUST be in the form of an email address. 154 + */ 155 + email?: string; 156 + /** 157 + * The identifying name of the contact person/organization. 158 + */ 159 + name?: string; 160 + /** 161 + * The URL pointing to the contact information. This MUST be in the form of a URL. 162 + */ 163 + url?: string; 164 + } 165 + 166 + /** 167 + * License information for the exposed API. 168 + * 169 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 170 + * 171 + * @example 172 + * ```yaml 173 + * name: Apache 2.0 174 + * identifier: Apache-2.0 175 + * ``` 176 + */ 177 + interface LicenseObject { 178 + /** 179 + * An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field. 180 + */ 181 + identifier?: string; 182 + /** 183 + * **REQUIRED**. The license name used for the API. 184 + */ 185 + name: string; 186 + /** 187 + * A URL to the license used for the API. This MUST be in the form of a URL. The `url` field is mutually exclusive of the `identifier` field. 188 + */ 189 + url?: string; 190 + } 191 + 192 + /** 193 + * Each Media Type Object provides schema and examples for the media type identified by its key. 194 + * 195 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 196 + * 197 + * @example 198 + * ```yaml 199 + * application/json: 200 + * schema: 201 + * $ref: "#/components/schemas/Pet" 202 + * examples: 203 + * cat: 204 + * summary: An example of a cat 205 + * value: 206 + * name: Fluffy 207 + * petType: Cat 208 + * color: White 209 + * gender: male 210 + * breed: Persian 211 + * dog: 212 + * summary: An example of a dog with a cat's name 213 + * value: 214 + * name: Puma 215 + * petType: Dog 216 + * color: Black 217 + * gender: Female 218 + * breed: Mixed 219 + * frog: 220 + * $ref: "#/components/examples/frog-example" 221 + * ``` 222 + */ 223 + interface MediaTypeObject { 224 + /** 225 + * 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`. 226 + */ 227 + encoding?: Record<string, any>; 228 + /** 229 + * Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. 230 + */ 231 + example?: unknown; 232 + /** 233 + * Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. 234 + */ 235 + examples?: Record<string, any | ReferenceObject>; 236 + /** 237 + * The schema defining the content of the request, response, or parameter. 238 + */ 239 + schema?: any; 240 + } 241 + 242 + /** 243 + * Describes a single API operation on a path. 244 + * 245 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 246 + * 247 + * @example 248 + * ```yaml 249 + * tags: 250 + * - pet 251 + * summary: Updates a pet in the store with form data 252 + * operationId: updatePetWithForm 253 + * parameters: 254 + * - name: petId 255 + * in: path 256 + * description: ID of pet that needs to be updated 257 + * required: true 258 + * schema: 259 + * type: string 260 + * requestBody: 261 + * content: 262 + * 'application/x-www-form-urlencoded': 263 + * schema: 264 + * type: object 265 + * properties: 266 + * name: 267 + * description: Updated name of the pet 268 + * type: string 269 + * status: 270 + * description: Updated status of the pet 271 + * type: string 272 + * required: 273 + * - status 274 + * responses: 275 + * '200': 276 + * description: Pet updated. 277 + * content: 278 + * 'application/json': {} 279 + * 'application/xml': {} 280 + * '405': 281 + * description: Method Not Allowed 282 + * content: 283 + * 'application/json': {} 284 + * 'application/xml': {} 285 + * security: 286 + * - petstore_auth: 287 + * - write:pets 288 + * - read:pets 289 + * ``` 290 + */ 291 + interface OperationObject { 292 + /** 293 + * 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. 294 + */ 295 + callbacks?: Record<string, any | ReferenceObject>; 296 + /** 297 + * Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. 298 + */ 299 + deprecated?: boolean; 300 + /** 301 + * A verbose explanation of the operation behavior. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 302 + */ 303 + description?: string; 304 + /** 305 + * Additional external documentation for this operation. 306 + */ 307 + externalDocs?: ExternalDocumentationObject; 308 + /** 309 + * Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. 310 + */ 311 + operationId?: string; 312 + /** 313 + * 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}. 314 + */ 315 + parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 316 + /** 317 + * 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. 318 + */ 319 + requestBody?: any | ReferenceObject; 320 + /** 321 + * The list of possible responses as they are returned from executing this operation. 322 + */ 323 + responses?: ResponsesObject; 324 + /** 325 + * 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. 326 + */ 327 + security?: ReadonlyArray<SecurityRequirementObject>; 328 + /** 329 + * 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. 330 + */ 331 + servers?: ReadonlyArray<ServerObject>; 332 + /** 333 + * A short summary of what the operation does. 334 + */ 335 + summary?: string; 336 + /** 337 + * A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. 338 + */ 339 + tags?: ReadonlyArray<string>; 340 + } 341 + 342 + /** 343 + * Describes a single operation parameter. 344 + * 345 + * 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}. 346 + * 347 + * **Parameter Locations** 348 + * 349 + * There are four possible parameter locations specified by the `in` field: 350 + * 351 + * - path - Used together with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating Path Templating}, where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. 352 + * - query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. 353 + * - header - Custom headers that are expected as part of the request. Note that {@link https://datatracker.ietf.org/doc/html/rfc7230#page-22 RFC7230} states header names are case insensitive. 354 + * - cookie - Used to pass a specific cookie value to the API. 355 + * 356 + * The rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterSchema `schema`} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} can describe the structure and syntax of the parameter. 357 + * 358 + * For more complex scenarios, the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterContent `content`} property can define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. 359 + * 360 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 361 + * 362 + * A header parameter with an array of 64 bit integer numbers: 363 + * 364 + * @example 365 + * ```yaml 366 + * name: token 367 + * in: header 368 + * description: token to be passed as a header 369 + * required: true 370 + * schema: 371 + * type: array 372 + * items: 373 + * type: integer 374 + * format: int64 375 + * style: simple 376 + * ``` 377 + * 378 + * A path parameter of a string value: 379 + * 380 + * @example 381 + * ```yaml 382 + * name: username 383 + * in: path 384 + * description: username to fetch 385 + * required: true 386 + * schema: 387 + * type: string 388 + * ``` 389 + * 390 + * An optional query parameter of a string value, allowing multiple values by repeating the query parameter: 391 + * 392 + * @example 393 + * ```yaml 394 + * name: id 395 + * in: query 396 + * description: ID of the object to fetch 397 + * required: false 398 + * schema: 399 + * type: array 400 + * items: 401 + * type: string 402 + * style: form 403 + * explode: true 404 + * ``` 405 + * 406 + * A free-form query parameter, allowing undefined parameters of a specific type: 407 + * 408 + * @example 409 + * ```yaml 410 + * in: query 411 + * name: freeForm 412 + * schema: 413 + * type: object 414 + * additionalProperties: 415 + * type: integer 416 + * style: form 417 + * ``` 418 + * 419 + * A complex parameter using `content` to define serialization: 420 + * 421 + * @example 422 + * ```yaml 423 + * in: query 424 + * name: coordinates 425 + * content: 426 + * application/json: 427 + * schema: 428 + * type: object 429 + * required: 430 + * - lat 431 + * - long 432 + * properties: 433 + * lat: 434 + * type: number 435 + * long: 436 + * type: number 437 + * ``` 438 + */ 439 + interface ParameterObject { 440 + /** 441 + * 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. 442 + */ 443 + allowEmptyValue?: boolean; 444 + /** 445 + * Determines whether the parameter value SHOULD allow reserved characters, as defined by {@link https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 RFC3986} `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. 446 + */ 447 + allowReserved?: boolean; 448 + /** 449 + * A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. 450 + */ 451 + content?: Record<string, any>; 452 + /** 453 + * Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`. 454 + */ 455 + deprecated?: boolean; 456 + /** 457 + * A brief description of the parameter. This could contain examples of use. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 458 + */ 459 + description?: string; 460 + /** 461 + * Example of the parameter's potential value. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` that contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. 462 + */ 463 + example?: unknown; 464 + /** 465 + * Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema. 466 + */ 467 + examples?: Record<string, any | ReferenceObject>; 468 + /** 469 + * When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} is `form`, the default value is `true`. For all other styles, the default value is `false`. 470 + */ 471 + explode?: boolean; 472 + /** 473 + * **REQUIRED**. The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`. 474 + */ 475 + in: 'cookie' | 'header' | 'path' | 'query'; 476 + /** 477 + * **REQUIRED**. The name of the parameter. Parameter names are _case sensitive_. 478 + * - If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn `in`} is `"path"`, the `name` field MUST correspond to a template expression occurring within the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsPath path} field in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object Paths Object}. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating Path Templating} for further information. 479 + * - If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn `in`} is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored. 480 + * - For all other cases, the `name` corresponds to the parameter name used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn `in`} property. 481 + */ 482 + name: string; 483 + /** 484 + * Determines whether this parameter is mandatory. If the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn parameter location} is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. 485 + */ 486 + required?: boolean; 487 + /** 488 + * The schema defining the type used for the parameter. 489 + */ 490 + schema?: any; 491 + /** 492 + * Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. 493 + */ 494 + style?: 495 + | 'deepObject' 496 + | 'form' 497 + | 'label' 498 + | 'matrix' 499 + | 'pipeDelimited' 500 + | 'simple' 501 + | 'spaceDelimited'; 502 + } 503 + 504 + /** 505 + * Describes the operations available on a single path. A Path Item MAY be empty, due to {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-filtering ACL constraints}. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. 506 + * 507 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 508 + * 509 + * @example 510 + * ```yaml 511 + * get: 512 + * description: Returns pets based on ID 513 + * summary: Find pets by ID 514 + * operationId: getPetsById 515 + * responses: 516 + * '200': 517 + * description: pet response 518 + * content: 519 + * '*\/*': 520 + * schema: 521 + * type: array 522 + * items: 523 + * $ref: '#/components/schemas/Pet' 524 + * default: 525 + * description: error payload 526 + * content: 527 + * 'text/html': 528 + * schema: 529 + * $ref: '#/components/schemas/ErrorModel' 530 + * parameters: 531 + * - name: id 532 + * in: path 533 + * description: ID of pet to use 534 + * required: true 535 + * schema: 536 + * type: array 537 + * items: 538 + * type: string 539 + * style: simple 540 + * ``` 541 + */ 542 + interface PathItemObject { 543 + /** 544 + * 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}. 545 + */ 546 + $ref?: string; 547 + /** 548 + * A definition of a DELETE operation on this path. 549 + */ 550 + delete?: OperationObject; 551 + /** 552 + * An optional, string description, intended to apply to all operations in this path. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 553 + */ 554 + description?: string; 555 + /** 556 + * A definition of a GET operation on this path. 557 + */ 558 + get?: OperationObject; 559 + /** 560 + * A definition of a HEAD operation on this path. 561 + */ 562 + head?: OperationObject; 563 + /** 564 + * A definition of a OPTIONS operation on this path. 565 + */ 566 + options?: OperationObject; 567 + /** 568 + * 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}. 569 + */ 570 + parameters?: ReadonlyArray<ParameterObject | ReferenceObject>; 571 + /** 572 + * A definition of a PATCH operation on this path. 573 + */ 574 + patch?: OperationObject; 575 + /** 576 + * A definition of a POST operation on this path. 577 + */ 578 + post?: OperationObject; 579 + /** 580 + * A definition of a PUT operation on this path. 581 + */ 582 + put?: OperationObject; 583 + /** 584 + * An alternative `server` array to service all operations in this path. 585 + */ 586 + servers?: ReadonlyArray<ServerObject>; 587 + /** 588 + * An optional, string summary, intended to apply to all operations in this path. 589 + */ 590 + summary?: string; 591 + /** 592 + * A definition of a TRACE operation on this path. 593 + */ 594 + trace?: OperationObject; 595 + } 596 + 597 + /** 598 + * A simple object to allow referencing other components in the OpenAPI document, internally and externally. 599 + * 600 + * The `$ref` string value contains a URI {@link https://datatracker.ietf.org/doc/html/rfc3986 RFC3986}, which identifies the location of the value being referenced. 601 + * 602 + * 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}. 603 + * 604 + * This object cannot be extended with additional properties and any properties added SHALL be ignored. 605 + * 606 + * Note that this restriction on additional properties is a difference between Reference Objects and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object `Schema Objects`} that contain a `$ref` keyword. 607 + * 608 + * Reference Object Example 609 + * 610 + * @example 611 + * ```yaml 612 + * $ref: '#/components/schemas/Pet' 613 + * ``` 614 + * 615 + * Relative Schema Document Example 616 + * 617 + * @example 618 + * ```yaml 619 + * $ref: Pet.yaml 620 + * ``` 621 + * 622 + * Relative Documents With Embedded Schema Example 623 + * 624 + * @example 625 + * ```yaml 626 + * $ref: definitions.yaml#/Pet 627 + * ``` 628 + */ 629 + interface ReferenceObject { 630 + /** 631 + * **REQUIRED**. The reference identifier. This MUST be in the form of a URI. 632 + */ 633 + $ref: string; 634 + /** 635 + * A description which by default SHOULD override that of the referenced component. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect. 636 + */ 637 + description?: string; 638 + /** 639 + * A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect. 640 + */ 641 + summary?: string; 642 + } 643 + 644 + /** 645 + * Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. 646 + * 647 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 648 + * 649 + * Response of an array of a complex type: 650 + * 651 + * @example 652 + * ```yaml 653 + * description: A complex object array response 654 + * content: 655 + * application/json: 656 + * schema: 657 + * type: array 658 + * items: 659 + * $ref: '#/components/schemas/VeryComplexType' 660 + * ``` 661 + * 662 + * Response with a string type: 663 + * 664 + * @example 665 + * ```yaml 666 + * description: A simple string response 667 + * content: 668 + * text/plain: 669 + * schema: 670 + * type: string 671 + * ``` 672 + * 673 + * Plain text response with headers: 674 + * 675 + * @example 676 + * ```yaml 677 + * description: A simple string response 678 + * content: 679 + * text/plain: 680 + * schema: 681 + * type: string 682 + * example: 'whoa!' 683 + * headers: 684 + * X-Rate-Limit-Limit: 685 + * description: The number of allowed requests in the current period 686 + * schema: 687 + * type: integer 688 + * X-Rate-Limit-Remaining: 689 + * description: The number of remaining requests in the current period 690 + * schema: 691 + * type: integer 692 + * X-Rate-Limit-Reset: 693 + * description: The number of seconds left in the current period 694 + * schema: 695 + * type: integer 696 + * ``` 697 + * 698 + * Response with no return value: 699 + * 700 + * @example 701 + * ```yaml 702 + * description: object created 703 + * ``` 704 + */ 705 + interface ResponseObject { 706 + /** 707 + * 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/* 708 + */ 709 + content?: Record<string, MediaTypeObject>; 710 + /** 711 + * **REQUIRED**. A description of the response. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 712 + */ 713 + description: string; 714 + /** 715 + * Maps a header name to its definition. {@link https://datatracker.ietf.org/doc/html/rfc7230#page-22 RFC7230} states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. 716 + */ 717 + headers?: Record<string, HeaderObject | ReferenceObject>; 718 + /** 719 + * A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Component Objects}. 720 + */ 721 + links?: Record<string, any | ReferenceObject>; 722 + } 723 + 724 + /** 725 + * A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. 726 + * 727 + * The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. 728 + * 729 + * The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the `Responses Object`. 730 + * 731 + * The `Responses Object` MUST contain at least one response code, and if only one response code is provided it SHOULD be the response for a successful operation call. 732 + * 733 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 734 + * 735 + * A 200 response for a successful operation and a default response for others (implying an error): 736 + * 737 + * @example 738 + * ```yaml 739 + * '200': 740 + * description: a pet to be returned 741 + * content: 742 + * application/json: 743 + * schema: 744 + * $ref: '#/components/schemas/Pet' 745 + * default: 746 + * description: Unexpected error 747 + * content: 748 + * application/json: 749 + * schema: 750 + * $ref: '#/components/schemas/ErrorModel' 751 + * ``` 752 + */ 753 + interface ResponsesObject { 754 + /** 755 + * 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. 756 + */ 757 + [statusCode: string]: ResponseObject | ReferenceObject | undefined; 758 + /** 759 + * The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. 760 + */ 761 + default?: ResponseObject | ReferenceObject; 762 + } 763 + 764 + /** 765 + * 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}. 766 + * 767 + * Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. 768 + * 769 + * When a list of Security Requirement Objects is defined on the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object OpenAPI Object} or {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request. 770 + * 771 + * Non-OAuth2 Security Requirement 772 + * 773 + * @example 774 + * ```yaml 775 + * api_key: [] 776 + * ``` 777 + * 778 + * OAuth2 Security Requirement 779 + * 780 + * @example 781 + * ```yaml 782 + * petstore_auth: 783 + * - write:pets 784 + * - read:pets 785 + * ``` 786 + * 787 + * Optional OAuth2 Security 788 + * 789 + * @example 790 + * ```yaml 791 + * security: 792 + * - {} 793 + * - petstore_auth: 794 + * - write:pets 795 + * - read:pets 796 + * ``` 797 + */ 798 + interface SecurityRequirementObject { 799 + /** 800 + * 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. 801 + */ 802 + [name: string]: ReadonlyArray<string>; 803 + } 804 + 805 + /** 806 + * An object representing a Server. 807 + * 808 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 809 + * 810 + * @example 811 + * ```yaml 812 + * url: https://development.gigantic-server.com/v1 813 + * description: Development server 814 + * ``` 815 + */ 816 + interface ServerObject { 817 + /** 818 + * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 819 + */ 820 + description?: string; 821 + /** 822 + * **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. 823 + */ 824 + url: string; 825 + /** 826 + * A map between a variable name and its value. The value is used for substitution in the server's URL template. 827 + */ 828 + variables?: Record<string, ServerVariableObject>; 829 + } 830 + 831 + /** 832 + * An object representing a Server Variable for server URL template substitution. 833 + * 834 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 835 + */ 836 + interface ServerVariableObject { 837 + /** 838 + * **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. 839 + */ 840 + default: string; 841 + /** 842 + * An optional description for the server variable. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 843 + */ 844 + description?: string; 845 + /** 846 + * An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty. 847 + */ 848 + enum?: ReadonlyArray<string>; 849 + } 850 + 851 + /** 852 + * Adds metadata to a single tag that is used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. 853 + * 854 + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. 855 + * 856 + * @example 857 + * ```yaml 858 + * name: pet 859 + * description: Pets operations 860 + * ``` 861 + */ 862 + interface TagObject { 863 + /** 864 + * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. 865 + */ 866 + description?: string; 867 + /** 868 + * Additional external documentation for this tag. 869 + */ 870 + externalDocs?: ExternalDocumentationObject; 871 + /** 872 + * **REQUIRED**. The name of the tag. 873 + */ 874 + name: string; 875 + }
+1
packages/openapi-ts/src/openApi/common/parser/__tests__/operation.spec.ts
··· 11 11 configFile: '', 12 12 debug: false, 13 13 dryRun: true, 14 + experimental_parser: false, 14 15 exportCore: false, 15 16 input: '', 16 17 output: {
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApi.ts
··· 10 10 import type { OpenApiTag } from './OpenApiTag'; 11 11 12 12 /** 13 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md 13 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md 14 14 */ 15 15 export interface OpenApi { 16 16 basePath?: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiExternalDocs.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#external-documentation-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#external-documentation-object 3 3 */ 4 4 export interface OpenApiExternalDocs { 5 5 description?: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiHeader.ts
··· 2 2 import type { OpenApiItems } from './OpenApiItems'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#header-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#header-object 6 6 */ 7 7 export interface OpenApiHeader { 8 8 collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes';
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiInfo.ts
··· 2 2 import type { OpenApiLicense } from './OpenApiLicense'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#info-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#info-object 6 6 */ 7 7 export interface OpenApiInfo { 8 8 contact?: OpenApiContact;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiItems.ts
··· 1 1 import type { WithEnumExtension } from '../../common/interfaces/WithEnumExtension'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#items-object) 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#items-object) 5 5 */ 6 6 export interface OpenApiItems extends WithEnumExtension { 7 7 collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes';
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiLicense.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#license-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#license-object 3 3 */ 4 4 export interface OpenApiLicense { 5 5 name: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiOperation.ts
··· 4 4 import type { OpenApiSecurityRequirement } from './OpenApiSecurityRequirement'; 5 5 6 6 /** 7 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operation-object 7 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-object 8 8 */ 9 9 export interface OpenApiOperation { 10 10 consumes?: string[];
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiParameter.ts
··· 5 5 import type { OpenApiSchema } from './OpenApiSchema'; 6 6 7 7 /** 8 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameter-object 8 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameter-object 9 9 */ 10 10 export interface OpenApiParameter 11 11 extends OpenApiReference,
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiPath.ts
··· 3 3 import type { OpenApiReference } from './OpenApiReference'; 4 4 5 5 /** 6 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#path-item-object 6 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#path-item-object 7 7 */ 8 8 export interface OpenApiPath extends OpenApiReference { 9 9 connect?: OpenApiOperation;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiReference.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#reference-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object 3 3 */ 4 4 export interface OpenApiReference { 5 5 $ref?: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiResponse.ts
··· 5 5 import type { OpenApiSchema } from './OpenApiSchema'; 6 6 7 7 /** 8 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#response-object 8 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#response-object 9 9 */ 10 10 export interface OpenApiResponse extends OpenApiReference { 11 11 description: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiResponses.ts
··· 1 1 import type { OpenApiResponse } from './OpenApiResponse'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responses-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#responses-object 5 5 */ 6 6 interface Response { 7 7 [httpcode: string]: OpenApiResponse;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSchema.ts
··· 6 6 import type { OpenApiXml } from './OpenApiXml'; 7 7 8 8 /** 9 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schema-object 9 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#schema-object 10 10 */ 11 11 export interface OpenApiSchema 12 12 extends OpenApiReference,
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSecurityRequirement.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-requirement-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#security-requirement-object 3 3 */ 4 4 export interface OpenApiSecurityRequirement { 5 5 [key: string]: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSecurityScheme.ts
··· 1 1 import type { Dictionary } from '../../common/interfaces/Dictionary'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-scheme-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#security-scheme-object 5 5 */ 6 6 export interface OpenApiSecurityScheme { 7 7 authorizationUrl?: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiTag.ts
··· 1 1 import type { OpenApiExternalDocs } from './OpenApiExternalDocs'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#tag-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#tag-object 5 5 */ 6 6 export interface OpenApiTag { 7 7 description?: string;
+1 -1
packages/openapi-ts/src/openApi/v2/interfaces/OpenApiXml.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#xml-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#xml-object 3 3 */ 4 4 export interface OpenApiXml { 5 5 attribute?: boolean;
+1
packages/openapi-ts/src/openApi/v2/parser/__tests__/getServices.spec.ts
··· 12 12 configFile: '', 13 13 debug: false, 14 14 dryRun: true, 15 + experimental_parser: false, 15 16 exportCore: true, 16 17 input: '', 17 18 output: {
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApi.ts
··· 7 7 import type { OpenApiTag } from './OpenApiTag'; 8 8 9 9 /** 10 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md 10 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md 11 11 */ 12 12 export interface OpenApi { 13 13 components?: OpenApiComponents;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiCallback.ts
··· 2 2 import type { OpenApiReference } from './OpenApiReference'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#callback-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object 6 6 */ 7 7 interface Callback { 8 8 [key: string]: OpenApiPath;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiComponents.ts
··· 10 10 import type { OpenApiSecurityScheme } from './OpenApiSecurityScheme'; 11 11 12 12 /** 13 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#components-object 13 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object 14 14 */ 15 15 export interface OpenApiComponents { 16 16 callbacks?: Dictionary<OpenApiCallback>;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiContact.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#contact-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#contact-object 3 3 */ 4 4 export interface OpenApiContact { 5 5 email?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiDiscriminator.ts
··· 1 1 import type { Dictionary } from '../../common/interfaces/Dictionary'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#discriminator-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#discriminator-object 5 5 */ 6 6 export interface OpenApiDiscriminator { 7 7 mapping?: Dictionary<string>;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiEncoding.ts
··· 2 2 import type { OpenApiHeader } from './OpenApiHeader'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#encoding-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encoding-object 6 6 */ 7 7 export interface OpenApiEncoding { 8 8 allowReserved?: boolean;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiExample.ts
··· 1 1 import type { OpenApiReference } from './OpenApiReference'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#example-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object 5 5 */ 6 6 export interface OpenApiExample extends OpenApiReference { 7 7 description?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiExternalDocs.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#external-documentation-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#external-documentation-object 3 3 */ 4 4 export interface OpenApiExternalDocs { 5 5 description?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiHeader.ts
··· 4 4 import type { OpenApiSchema } from './OpenApiSchema'; 5 5 6 6 /** 7 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#header-object 7 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#header-object 8 8 */ 9 9 export interface OpenApiHeader extends OpenApiReference { 10 10 allowEmptyValue?: boolean;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiInfo.ts
··· 2 2 import type { OpenApiLicense } from './OpenApiLicense'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#info-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#info-object 6 6 */ 7 7 export interface OpenApiInfo { 8 8 contact?: OpenApiContact;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiLicense.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#license-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#license-object 3 3 */ 4 4 export interface OpenApiLicense { 5 5 name: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiLink.ts
··· 3 3 import type { OpenApiServer } from './OpenApiServer'; 4 4 5 5 /** 6 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#link-object 6 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#link-object 7 7 */ 8 8 export interface OpenApiLink extends OpenApiReference { 9 9 description?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiMediaType.ts
··· 5 5 import type { OpenApiSchema } from './OpenApiSchema'; 6 6 7 7 /** 8 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#media-type-object 8 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object 9 9 */ 10 10 export interface OpenApiMediaType extends OpenApiReference { 11 11 encoding?: Dictionary<OpenApiEncoding>;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOAuthFlow.ts
··· 1 1 import type { Dictionary } from '../../common/interfaces/Dictionary'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#oauth-flow-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauth-flow-object 5 5 */ 6 6 export interface OpenApiOAuthFlow { 7 7 authorizationUrl: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOAuthFlows.ts
··· 1 1 import type { OpenApiOAuthFlow } from './OpenApiOAuthFlow'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#oauth-flows-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauth-flows-object 5 5 */ 6 6 export interface OpenApiOAuthFlows { 7 7 authorizationCode?: OpenApiOAuthFlow;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOperation.ts
··· 8 8 import type { OpenApiServer } from './OpenApiServer'; 9 9 10 10 /** 11 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operation-object 11 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object 12 12 */ 13 13 export interface OpenApiOperation { 14 14 callbacks?: Dictionary<OpenApiCallback>;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiParameter.ts
··· 23 23 } 24 24 25 25 /** 26 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#parameter-object 26 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object 27 27 */ 28 28 export interface OpenApiParameter extends OpenApiReference { 29 29 allowEmptyValue?: boolean;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiPath.ts
··· 3 3 import type { OpenApiServer } from './OpenApiServer'; 4 4 5 5 /** 6 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#path-item-object 6 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object 7 7 */ 8 8 export interface OpenApiPath { 9 9 connect?: OpenApiOperation;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiPaths.ts
··· 1 1 import type { OpenApiPath } from './OpenApiPath'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#paths-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object 5 5 */ 6 6 export interface OpenApiPaths { 7 7 [path: string]: OpenApiPath;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiReference.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#reference-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object 3 3 */ 4 4 export interface OpenApiReference { 5 5 $ref?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiRequestBody.ts
··· 3 3 import type { OpenApiReference } from './OpenApiReference'; 4 4 5 5 /** 6 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#request-body-object 6 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object 7 7 */ 8 8 export interface OpenApiRequestBody extends OpenApiReference { 9 9 content: Dictionary<OpenApiMediaType>;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiResponse.ts
··· 5 5 import type { OpenApiReference } from './OpenApiReference'; 6 6 7 7 /** 8 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#response-object 8 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object 9 9 */ 10 10 export interface OpenApiResponse extends OpenApiReference { 11 11 content?: Dictionary<OpenApiMediaType>;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiResponses.ts
··· 2 2 import type { OpenApiResponse } from './OpenApiResponse'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responses-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#responses-object 6 6 */ 7 7 interface Response { 8 8 [httpcode: string]: OpenApiResponse;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiSchema.ts
··· 6 6 import type { OpenApiXml } from './OpenApiXml'; 7 7 8 8 /** 9 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#schema-object 9 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object 10 10 */ 11 11 export interface OpenApiSchema extends OpenApiReference, WithEnumExtension { 12 12 additionalProperties?: boolean | OpenApiSchema;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiSecurityRequirement.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#security-requirement-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-requirement-object 3 3 */ 4 4 export interface OpenApiSecurityRequirement { 5 5 [name: string]: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiSecurityScheme.ts
··· 2 2 import type { OpenApiReference } from './OpenApiReference'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#security-scheme-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object 6 6 */ 7 7 export interface OpenApiSecurityScheme extends OpenApiReference { 8 8 bearerFormat?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServer.ts
··· 2 2 import type { OpenApiServerVariable } from './OpenApiServerVariable'; 3 3 4 4 /** 5 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#server-object 5 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object 6 6 */ 7 7 export interface OpenApiServer { 8 8 description?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServerVariable.ts
··· 1 1 import type { WithEnumExtension } from '../../common/interfaces/WithEnumExtension'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#server-variable-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-variable-object 5 5 */ 6 6 export interface OpenApiServerVariable extends WithEnumExtension { 7 7 default: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiTag.ts
··· 1 1 import type { OpenApiExternalDocs } from './OpenApiExternalDocs'; 2 2 3 3 /** 4 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#tag-object 4 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object 5 5 */ 6 6 export interface OpenApiTag { 7 7 description?: string;
+1 -1
packages/openapi-ts/src/openApi/v3/interfaces/OpenApiXml.ts
··· 1 1 /** 2 - * {@link} https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#xml-object 2 + * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xml-object 3 3 */ 4 4 export interface OpenApiXml { 5 5 attribute?: boolean;
+1
packages/openapi-ts/src/openApi/v3/parser/__tests__/getServices.spec.ts
··· 12 12 configFile: '', 13 13 debug: false, 14 14 dryRun: true, 15 + experimental_parser: false, 15 16 exportCore: true, 16 17 input: '', 17 18 output: {
+5
packages/openapi-ts/src/types/config.ts
··· 57 57 */ 58 58 dryRun?: boolean; 59 59 /** 60 + * Use the experimental parser? 61 + * @default false 62 + */ 63 + experimental_parser?: boolean; 64 + /** 60 65 * Generate core client classes? 61 66 * @default true 62 67 */
+2
packages/openapi-ts/src/utils/__tests__/handlebars.spec.ts
··· 16 16 configFile: '', 17 17 debug: false, 18 18 dryRun: false, 19 + experimental_parser: false, 19 20 exportCore: true, 20 21 input: '', 21 22 output: { ··· 49 50 configFile: '', 50 51 debug: false, 51 52 dryRun: false, 53 + experimental_parser: false, 52 54 exportCore: true, 53 55 input: '', 54 56 output: {
+22
packages/openapi-ts/src/utils/performance.ts
··· 1 + const idEnd = (id: string) => `${id}-end`; 2 + 3 + const idLength = (id: string) => `${id}-length`; 4 + 5 + const idStart = (id: string) => `${id}-start`; 6 + 7 + export const Performance = { 8 + clear: () => { 9 + performance.clearMarks(); 10 + performance.clearMeasures(); 11 + }, 12 + end: (id: string) => { 13 + performance.mark(idEnd(id)); 14 + }, 15 + getEntriesByName: (id: string) => performance.getEntriesByName(idLength(id)), 16 + measure: (id: string) => { 17 + performance.measure(idLength(id), idStart(id), idEnd(id)); 18 + }, 19 + start: (id: string) => { 20 + performance.mark(idStart(id)); 21 + }, 22 + };
+58
packages/openapi-ts/test/performance.spec.ts
··· 1 + import { describe, expect, it } from 'vitest'; 2 + 3 + import { createClient } from '../src/index'; 4 + import { Performance } from '../src/utils/performance'; 5 + 6 + const V3_SPEC_PATH = './test/spec/v3.json'; 7 + 8 + const OUTPUT_PREFIX = './test/generated/'; 9 + 10 + const toOutputPath = (name: string) => `${OUTPUT_PREFIX}${name}/`; 11 + 12 + describe('performance', () => { 13 + it('creates client under 500ms', async () => { 14 + Performance.clear(); 15 + 16 + await createClient({ 17 + client: '@hey-api/client-fetch', 18 + input: V3_SPEC_PATH, 19 + output: toOutputPath('perf'), 20 + }); 21 + 22 + Performance.measure('createClient'); 23 + const measures = Performance.getEntriesByName('createClient'); 24 + 25 + expect(measures[0].duration).toBeLessThanOrEqual(500); 26 + }); 27 + 28 + it('parses spec under 300ms', async () => { 29 + Performance.clear(); 30 + 31 + await createClient({ 32 + client: '@hey-api/client-fetch', 33 + input: V3_SPEC_PATH, 34 + output: toOutputPath('perf'), 35 + }); 36 + 37 + Performance.measure('parser'); 38 + const measures = Performance.getEntriesByName('parser'); 39 + 40 + expect(measures[0].duration).toBeLessThanOrEqual(300); 41 + }); 42 + 43 + it('parses spec under 150ms (experimental)', async () => { 44 + Performance.clear(); 45 + 46 + await createClient({ 47 + client: '@hey-api/client-fetch', 48 + experimental_parser: true, 49 + input: V3_SPEC_PATH, 50 + output: toOutputPath('perf'), 51 + }); 52 + 53 + Performance.measure('experimental_parser'); 54 + const measures = Performance.getEntriesByName('experimental_parser'); 55 + 56 + expect(measures[0].duration).toBeLessThanOrEqual(150); 57 + }); 58 + });
+1
packages/openapi-ts/test/sample.cjs
··· 9 9 name: '@hey-api/client-fetch', 10 10 }, 11 11 // debug: true, 12 + experimental_parser: true, 12 13 // input: './test/spec/v3-transforms.json', 13 14 input: './test/spec/v3.json', 14 15 // input: './test/spec/v2.json',