@hey-api/openapi-ts 0.57.1 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,3 +1,29 @@
1
+ import { rmSync } from 'node:fs';
2
+ import ts from 'typescript';
3
+
4
+ interface ImportExportItemObject {
5
+ alias?: string;
6
+ asType?: boolean;
7
+ name: string;
8
+ }
9
+
10
+ type ExtractWithDiscriminator<T, Discriminator> = T extends Discriminator ? T : never;
11
+ /**
12
+ * Accepts an array of elements union and attempts to extract only objects.
13
+ * For example, Array<string | number | { id: string }> would result in
14
+ * Array<{ id: string }>.
15
+ */
16
+ type ExtractArrayOfObjects<T, Discriminator> = T extends Array<infer U> ? Array<ExtractWithDiscriminator<U, Discriminator>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<ExtractWithDiscriminator<U, Discriminator>> : never;
17
+ type Files = Record<string, TypeScriptFile>;
18
+ /**
19
+ * Transforms an array of objects into an optional object map.
20
+ * For example, Array<{ id: string }> would result in
21
+ * { [key: string]?: { id: string } }
22
+ */
23
+ type ArrayOfObjectsToObjectMap<T extends ReadonlyArray<Record<string, any>>, D extends keyof T[number]> = {
24
+ [K in T[number][D]]?: Extract<T[number], Record<D, K>>;
25
+ };
26
+
1
27
  type PluginNames =
2
28
  | '@hey-api/schemas'
3
29
  | '@hey-api/sdk'
@@ -11,17 +37,73 @@ type PluginNames =
11
37
  | 'fastify'
12
38
  | 'zod';
13
39
 
14
- interface PluginName<Name extends PluginNames> {
15
- name: Name;
16
- }
17
-
18
- interface CommonConfig {
40
+ interface BaseConfig {
19
41
  // eslint-disable-next-line @typescript-eslint/ban-types
20
42
  name: PluginNames | (string & {});
21
43
  output?: string;
22
44
  }
23
45
 
24
- type UserConfig$1<Config extends CommonConfig> = Omit<Config, 'output'>;
46
+ interface Dependencies {
47
+ /**
48
+ * Required dependencies will be always processed, regardless of whether
49
+ * a user defines them in their `plugins` config.
50
+ */
51
+ _dependencies?: ReadonlyArray<PluginNames>;
52
+ /**
53
+ * Optional dependencies are not processed unless a user explicitly defines
54
+ * them in their `plugins` config.
55
+ */
56
+ _optionalDependencies?: ReadonlyArray<PluginNames>;
57
+ }
58
+
59
+ /**
60
+ * Public Plugin API.
61
+ */
62
+ declare namespace Plugin {
63
+ export type Config<Config extends BaseConfig> = Config &
64
+ Dependencies & {
65
+ _handler: Plugin.Handler<Config>;
66
+ _handlerLegacy: Plugin.LegacyHandler<Config>;
67
+ };
68
+
69
+ export type DefineConfig<Config extends BaseConfig> = (
70
+ config?: Plugin.UserConfig<Config>,
71
+ ) => Plugin.Config<Config>;
72
+
73
+ /**
74
+ * Plugin implementation for experimental parser.
75
+ */
76
+ export type Handler<Config extends BaseConfig> = (args: {
77
+ context: IRContext;
78
+ plugin: Plugin.Instance<Config>;
79
+ }) => void;
80
+
81
+ export type Instance<Config extends BaseConfig> = Omit<
82
+ Config,
83
+ '_dependencies' | '_handler' | '_handlerLegacy' | '_optionalDependencies'
84
+ > &
85
+ Pick<Required<Config>, 'output'>;
86
+
87
+ /**
88
+ * Plugin implementation for legacy parser. Use only if you need to support
89
+ * OpenAPI 2.0 since that isn't supported by the experimental parser yet.
90
+ */
91
+ export type LegacyHandler<Config extends BaseConfig> = (args: {
92
+ client: Client;
93
+ files: Files;
94
+ openApi: OpenApi;
95
+ plugin: Plugin.Instance<Config>;
96
+ }) => void;
97
+
98
+ export interface Name<Name extends PluginNames> {
99
+ name: Name;
100
+ }
101
+
102
+ /**
103
+ * Users cannot modify output file path to avoid risk of conflicts.
104
+ */
105
+ export type UserConfig<Config extends BaseConfig> = Omit<Config, 'output'>;
106
+ }
25
107
 
26
108
  interface EnumExtensions {
27
109
  /**
@@ -3802,7 +3884,7 @@ interface XMLObject {
3802
3884
  wrapped?: boolean;
3803
3885
  }
3804
3886
 
3805
- interface Config$a extends PluginName<'@hey-api/schemas'> {
3887
+ interface Config$b extends Plugin.Name<'@hey-api/schemas'> {
3806
3888
  /**
3807
3889
  * Customise the schema name. By default, `{{name}}Schema` is used. `name` is a
3808
3890
  * valid JavaScript/TypeScript identifier, e.g. if your schema name is
@@ -3833,6 +3915,17 @@ interface Config$a extends PluginName<'@hey-api/schemas'> {
3833
3915
 
3834
3916
  type IRMediaType = 'form-data' | 'json' | 'url-search-params';
3835
3917
 
3918
+ interface IR {
3919
+ components?: IRComponentsObject;
3920
+ paths?: IRPathsObject;
3921
+ }
3922
+
3923
+ interface IRComponentsObject {
3924
+ parameters?: Record<string, IRParameterObject>;
3925
+ requestBodies?: Record<string, IRRequestBodyObject>;
3926
+ schemas?: Record<string, IRSchemaObject>;
3927
+ }
3928
+
3836
3929
  interface IRPathsObject {
3837
3930
  [path: `/${string}`]: IRPathItemObject;
3838
3931
  }
@@ -3918,6 +4011,12 @@ interface IRParameterObject
3918
4011
  | 'spaceDelimited';
3919
4012
  }
3920
4013
 
4014
+ interface IRRequestBodyObject
4015
+ extends Pick<JsonSchemaDraft2020_12, 'description'> {
4016
+ required?: boolean;
4017
+ schema: IRSchemaObject;
4018
+ }
4019
+
3921
4020
  interface IRResponsesObject {
3922
4021
  /**
3923
4022
  * 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.
@@ -4002,7 +4101,7 @@ interface IRSchemaObject
4002
4101
  | 'void';
4003
4102
  }
4004
4103
 
4005
- interface Config$9 extends PluginName<'@hey-api/sdk'> {
4104
+ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
4006
4105
  /**
4007
4106
  * Group operation methods into classes? When enabled, you can
4008
4107
  * select which classes to export with `sdk.include` and/or
@@ -4063,7 +4162,7 @@ interface Config$9 extends PluginName<'@hey-api/sdk'> {
4063
4162
  serviceNameBuilder?: string;
4064
4163
  }
4065
4164
 
4066
- interface Config$8 extends PluginName<'@hey-api/transformers'> {
4165
+ interface Config$9 extends Plugin.Name<'@hey-api/transformers'> {
4067
4166
  /**
4068
4167
  * Convert date strings into Date objects?
4069
4168
  * @default false
@@ -4076,25 +4175,43 @@ interface Config$8 extends PluginName<'@hey-api/transformers'> {
4076
4175
  output?: string;
4077
4176
  }
4078
4177
 
4079
- interface Config$7 extends PluginName<'@hey-api/typescript'> {
4178
+ interface Config$8 extends Plugin.Name<'@hey-api/typescript'> {
4080
4179
  /**
4081
4180
  * By default, enums are generated as TypeScript types. In addition to that,
4082
4181
  * you can choose to generate them as JavaScript objects, TypeScript enums,
4083
4182
  * or TypeScript enums contained within namespaces.
4183
+ *
4084
4184
  * @default false
4085
4185
  */
4086
4186
  enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false;
4087
4187
  /**
4188
+ * **This feature works only with the experimental parser**
4189
+ *
4190
+ * Defines casing of the enum keys. By default, we use `SCREAMING_SNAKE_CASE`.
4191
+ * This option has effect only when `enums` is defined.
4192
+ *
4193
+ * @default 'SCREAMING_SNAKE_CASE'
4194
+ */
4195
+ enumsCase?: StringCase;
4196
+ /**
4197
+ * **This feature works only with the experimental parser**
4198
+ *
4088
4199
  * By default, inline enums (enums not defined as reusable components in
4089
4200
  * the input file) are generated as inlined union types. You can set
4090
4201
  * `exportInlineEnums` to `true` to treat inline enums as reusable components.
4091
4202
  * When `true`, the exported enums will follow the style defined in `enums`.
4092
4203
  *
4093
- * This option works only with the experimental parser.
4094
- *
4095
4204
  * @default false
4096
4205
  */
4097
4206
  exportInlineEnums?: boolean;
4207
+ /**
4208
+ * **This feature works only with the experimental parser**
4209
+ *
4210
+ * Defines casing of the identifiers. By default, we use `PascalCase`.
4211
+ *
4212
+ * @default 'PascalCase'
4213
+ */
4214
+ identifierCase?: Exclude<StringCase, 'SCREAMING_SNAKE_CASE'>;
4098
4215
  /**
4099
4216
  * Include only types matching regular expression.
4100
4217
  *
@@ -4109,13 +4226,21 @@ interface Config$7 extends PluginName<'@hey-api/typescript'> {
4109
4226
  */
4110
4227
  output?: string;
4111
4228
  /**
4229
+ * **This feature works only with the legacy parser**
4230
+ *
4112
4231
  * Use your preferred naming pattern
4232
+ *
4113
4233
  * @default 'preserve'
4234
+ *
4235
+ * @deprecated
4114
4236
  */
4115
4237
  style?: 'PascalCase' | 'preserve';
4116
4238
  /**
4239
+ * **This feature works only with the legacy parser**
4240
+ *
4117
4241
  * Generate a tree of types containing all operations? It will be named
4118
4242
  * $OpenApiTs.
4243
+ *
4119
4244
  * @default false
4120
4245
  *
4121
4246
  * @deprecated
@@ -4123,8 +4248,8 @@ interface Config$7 extends PluginName<'@hey-api/typescript'> {
4123
4248
  tree?: boolean;
4124
4249
  }
4125
4250
 
4126
- interface Config$6
4127
- extends PluginName<'@tanstack/angular-query-experimental'> {
4251
+ interface Config$7
4252
+ extends Plugin.Name<'@tanstack/angular-query-experimental'> {
4128
4253
  /**
4129
4254
  * Generate {@link https://tanstack.com/query/v5/docs/framework/angular/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
4130
4255
  * @default true
@@ -4148,7 +4273,7 @@ interface Config$6
4148
4273
  queryOptions?: boolean;
4149
4274
  }
4150
4275
 
4151
- interface Config$5 extends PluginName<'@tanstack/react-query'> {
4276
+ interface Config$6 extends Plugin.Name<'@tanstack/react-query'> {
4152
4277
  /**
4153
4278
  * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
4154
4279
  * @default true
@@ -4172,7 +4297,7 @@ interface Config$5 extends PluginName<'@tanstack/react-query'> {
4172
4297
  queryOptions?: boolean;
4173
4298
  }
4174
4299
 
4175
- interface Config$4 extends PluginName<'@tanstack/solid-query'> {
4300
+ interface Config$5 extends Plugin.Name<'@tanstack/solid-query'> {
4176
4301
  /**
4177
4302
  * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
4178
4303
  * @default true
@@ -4196,7 +4321,7 @@ interface Config$4 extends PluginName<'@tanstack/solid-query'> {
4196
4321
  queryOptions?: boolean;
4197
4322
  }
4198
4323
 
4199
- interface Config$3 extends PluginName<'@tanstack/svelte-query'> {
4324
+ interface Config$4 extends Plugin.Name<'@tanstack/svelte-query'> {
4200
4325
  /**
4201
4326
  * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
4202
4327
  * @default true
@@ -4220,7 +4345,7 @@ interface Config$3 extends PluginName<'@tanstack/svelte-query'> {
4220
4345
  queryOptions?: boolean;
4221
4346
  }
4222
4347
 
4223
- interface Config$2 extends PluginName<'@tanstack/vue-query'> {
4348
+ interface Config$3 extends Plugin.Name<'@tanstack/vue-query'> {
4224
4349
  /**
4225
4350
  * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
4226
4351
  * @default true
@@ -4244,7 +4369,7 @@ interface Config$2 extends PluginName<'@tanstack/vue-query'> {
4244
4369
  queryOptions?: boolean;
4245
4370
  }
4246
4371
 
4247
- interface Config$1 extends PluginName<'fastify'> {
4372
+ interface Config$2 extends Plugin.Name<'fastify'> {
4248
4373
  /**
4249
4374
  * Name of the generated file.
4250
4375
  * @default 'fastify'
@@ -4255,7 +4380,7 @@ interface Config$1 extends PluginName<'fastify'> {
4255
4380
  // import type { IROperationObject, IRSchemaObject } from '../../ir/ir';
4256
4381
 
4257
4382
 
4258
- interface Config extends PluginName<'zod'> {
4383
+ interface Config$1 extends Plugin.Name<'zod'> {
4259
4384
  /**
4260
4385
  * Customise the Zod schema name. By default, `z{{name}}` is used,
4261
4386
  * where `name` is a definition name or an operation name.
@@ -4271,13 +4396,21 @@ interface Config extends PluginName<'zod'> {
4271
4396
  /**
4272
4397
  * User-facing plugin types.
4273
4398
  */
4274
- type UserPlugins = UserConfig$1<Config$a> | UserConfig$1<Config$9> | UserConfig$1<Config$8> | UserConfig$1<Config$7> | UserConfig$1<Config$6> | UserConfig$1<Config$5> | UserConfig$1<Config$4> | UserConfig$1<Config$3> | UserConfig$1<Config$2> | UserConfig$1<Config$1> | UserConfig$1<Config>;
4399
+ type UserPlugins = Plugin.UserConfig<Config$b> | Plugin.UserConfig<Config$a> | Plugin.UserConfig<Config$9> | Plugin.UserConfig<Config$8> | Plugin.UserConfig<Config$7> | Plugin.UserConfig<Config$6> | Plugin.UserConfig<Config$5> | Plugin.UserConfig<Config$4> | Plugin.UserConfig<Config$3> | Plugin.UserConfig<Config$2> | Plugin.UserConfig<Config$1>;
4400
+ /**
4401
+ * Internal plugin types.
4402
+ */
4403
+ type ClientPlugins = Plugin.Config<Config$b> | Plugin.Config<Config$a> | Plugin.Config<Config$9> | Plugin.Config<Config$8> | Plugin.Config<Config$7> | Plugin.Config<Config$6> | Plugin.Config<Config$5> | Plugin.Config<Config$4> | Plugin.Config<Config$3> | Plugin.Config<Config$2> | Plugin.Config<Config$1>;
4275
4404
 
4276
4405
  declare const CLIENTS: readonly ["@hey-api/client-axios", "@hey-api/client-fetch", "legacy/angular", "legacy/axios", "legacy/fetch", "legacy/node", "legacy/xhr"];
4277
4406
  type Client$2 = (typeof CLIENTS)[number];
4407
+ type Formatters = 'biome' | 'prettier';
4408
+ type Linters = 'biome' | 'eslint' | 'oxlint';
4409
+ type StringCase = 'camelCase' | 'PascalCase' | 'preserve' | 'snake_case' | 'SCREAMING_SNAKE_CASE';
4278
4410
  interface ClientConfig {
4279
4411
  /**
4280
4412
  * Manually set base in OpenAPI config instead of inferring from server value
4413
+ *
4281
4414
  * @deprecated
4282
4415
  */
4283
4416
  base?: string;
@@ -4292,6 +4425,7 @@ interface ClientConfig {
4292
4425
  * package and bundled with the rest of the generated output. This is
4293
4426
  * useful if you're repackaging the output, publishing it to other users,
4294
4427
  * and you don't want them to install any dependencies.
4428
+ *
4295
4429
  * @default false
4296
4430
  */
4297
4431
  bundle?: boolean;
@@ -4307,21 +4441,25 @@ interface ClientConfig {
4307
4441
  configFile?: string;
4308
4442
  /**
4309
4443
  * Run in debug mode?
4444
+ *
4310
4445
  * @default false
4311
4446
  */
4312
4447
  debug?: boolean;
4313
4448
  /**
4314
4449
  * Skip writing files to disk?
4450
+ *
4315
4451
  * @default false
4316
4452
  */
4317
4453
  dryRun?: boolean;
4318
4454
  /**
4319
- * Opt-in to the experimental parser?
4455
+ * Opt in to the experimental parser?
4456
+ *
4320
4457
  * @default false
4321
4458
  */
4322
4459
  experimentalParser?: boolean;
4323
4460
  /**
4324
4461
  * Generate core client classes?
4462
+ *
4325
4463
  * @default true
4326
4464
  */
4327
4465
  exportCore?: boolean;
@@ -4334,6 +4472,8 @@ interface ClientConfig {
4334
4472
  */
4335
4473
  input: string | Record<string, unknown> | {
4336
4474
  /**
4475
+ * **This feature works only with the experimental parser**
4476
+ *
4337
4477
  * Prevent parts matching the regular expression from being processed.
4338
4478
  * You can select both operations and components by reference within
4339
4479
  * the bundled input. In case of conflicts, `exclude` takes precedence
@@ -4345,6 +4485,8 @@ interface ClientConfig {
4345
4485
  */
4346
4486
  exclude?: string;
4347
4487
  /**
4488
+ * **This feature works only with the experimental parser**
4489
+
4348
4490
  * Process only parts matching the regular expression. You can select both
4349
4491
  * operations and components by reference within the bundled input. In
4350
4492
  * case of conflicts, `exclude` takes precedence over `include`.
@@ -4364,7 +4506,9 @@ interface ClientConfig {
4364
4506
  /**
4365
4507
  * Custom client class name. Please note this option is deprecated and
4366
4508
  * will be removed in favor of clients.
4509
+ *
4367
4510
  * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name
4511
+ *
4368
4512
  * @deprecated
4369
4513
  */
4370
4514
  name?: string;
@@ -4372,16 +4516,36 @@ interface ClientConfig {
4372
4516
  * The relative location of the output folder
4373
4517
  */
4374
4518
  output: string | {
4519
+ /**
4520
+ * **This feature works only with the experimental parser**
4521
+ *
4522
+ * Defines casing of the output fields. By default, we preserve `input`
4523
+ * values as data transforms incur a performance penalty at runtime.
4524
+ *
4525
+ * @default undefined
4526
+ */
4527
+ case?: Exclude<StringCase, 'SCREAMING_SNAKE_CASE'>;
4528
+ /**
4529
+ * Clean the `output` folder on every run? If disabled, this folder may
4530
+ * be used to store additional files. The default option is `true` to
4531
+ * reduce the risk of keeping outdated files around when configuration,
4532
+ * input, or package version changes.
4533
+ *
4534
+ * @default true
4535
+ */
4536
+ clean?: boolean;
4375
4537
  /**
4376
4538
  * Process output folder with formatter?
4539
+ *
4377
4540
  * @default false
4378
4541
  */
4379
- format?: 'biome' | 'prettier' | false;
4542
+ format?: Formatters | false;
4380
4543
  /**
4381
4544
  * Process output folder with linter?
4545
+ *
4382
4546
  * @default false
4383
4547
  */
4384
- lint?: 'biome' | 'eslint' | 'oxlint' | false;
4548
+ lint?: Linters | false;
4385
4549
  /**
4386
4550
  * The relative location of the output folder
4387
4551
  */
@@ -4394,21 +4558,226 @@ interface ClientConfig {
4394
4558
  /**
4395
4559
  * Path to custom request file. Please note this option is deprecated and
4396
4560
  * will be removed in favor of clients.
4561
+ *
4397
4562
  * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-request
4563
+ *
4398
4564
  * @deprecated
4399
4565
  */
4400
4566
  request?: string;
4401
4567
  /**
4402
4568
  * Use options or arguments functions. Please note this option is deprecated and
4403
4569
  * will be removed in favor of clients.
4570
+ *
4404
4571
  * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-useoptions
4572
+ *
4405
4573
  * @deprecated
4574
+ *
4406
4575
  * @default true
4407
4576
  */
4408
4577
  useOptions?: boolean;
4409
4578
  }
4410
4579
  interface UserConfig extends ClientConfig {
4411
4580
  }
4581
+ type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'input' | 'name' | 'output' | 'plugins' | 'request'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
4582
+ client: Extract<Required<ClientConfig>['client'], object>;
4583
+ input: ExtractWithDiscriminator<ClientConfig['input'], {
4584
+ path: unknown;
4585
+ }>;
4586
+ output: Extract<ClientConfig['output'], object>;
4587
+ pluginOrder: ReadonlyArray<ClientPlugins['name']>;
4588
+ plugins: ArrayOfObjectsToObjectMap<ExtractArrayOfObjects<ReadonlyArray<ClientPlugins>, {
4589
+ name: string;
4590
+ }>, 'name'>;
4591
+ };
4592
+
4593
+ interface Identifier {
4594
+ /**
4595
+ * Did this function add a new property to the file's `identifiers` map?
4596
+ */
4597
+ created: boolean;
4598
+ /**
4599
+ * The resolved identifier name. False means the identifier has been blacklisted.
4600
+ */
4601
+ name: string | false;
4602
+ }
4603
+ type Namespace = Record<string, Pick<Identifier, 'name'> & {
4604
+ /**
4605
+ * Ref to the type in OpenAPI specification.
4606
+ */
4607
+ $ref: string;
4608
+ }>;
4609
+ interface Namespaces {
4610
+ /**
4611
+ * Type namespace. Types, interfaces, and type aliases exist here.
4612
+ * @example
4613
+ * ```ts
4614
+ * export type Foo = string;
4615
+ * ```
4616
+ */
4617
+ type: Namespace;
4618
+ /**
4619
+ * Value namespace. Variables, functions, classes, and constants exist here.
4620
+ * @example
4621
+ * ```js
4622
+ * export const foo = '';
4623
+ * ```
4624
+ */
4625
+ value: Namespace;
4626
+ }
4627
+ declare class TypeScriptFile {
4628
+ private _headers;
4629
+ private _identifierCase;
4630
+ private _imports;
4631
+ private _items;
4632
+ private _name;
4633
+ private _path;
4634
+ namespaces: Namespaces;
4635
+ /**
4636
+ * Path relative to the client output root.
4637
+ */
4638
+ constructor({ dir, header, identifierCase, name, }: {
4639
+ dir: string;
4640
+ header?: boolean;
4641
+ identifierCase?: StringCase;
4642
+ name: string;
4643
+ });
4644
+ add(...nodes: Array<ts.Node | string>): void;
4645
+ /**
4646
+ * Prevents a specific identifier from being created. This is useful for
4647
+ * transformers where we know a certain transformer won't be needed, and
4648
+ * we want to avoid attempting to create since we know it won't happen.
4649
+ */
4650
+ blockIdentifier({ $ref, namespace, }: Pick<EnsureUniqueIdentifierData, '$ref'> & {
4651
+ namespace: keyof Namespaces;
4652
+ }): Identifier;
4653
+ identifier({ namespace, ...args }: Omit<EnsureUniqueIdentifierData, 'case' | 'namespace'> & {
4654
+ namespace: keyof Namespaces;
4655
+ }): Identifier;
4656
+ /**
4657
+ * Adds an import to the provided module. Handles duplication, returns added import.
4658
+ */
4659
+ import({ module, ...importedItem }: ImportExportItemObject & {
4660
+ module: string;
4661
+ }): ImportExportItemObject;
4662
+ isEmpty(): boolean;
4663
+ nameWithoutExtension(): string;
4664
+ relativePathToFile({ context, id, }: {
4665
+ context: IRContext;
4666
+ id: string;
4667
+ }): string;
4668
+ remove(options?: Parameters<typeof rmSync>[1]): void;
4669
+ /**
4670
+ * Removes last node form the stack. Works as undo.
4671
+ */
4672
+ removeNode(): void;
4673
+ private _setName;
4674
+ toString(separator?: string): string;
4675
+ write(separator?: string): void;
4676
+ }
4677
+ interface EnsureUniqueIdentifierData {
4678
+ $ref: string;
4679
+ case: StringCase | undefined;
4680
+ count?: number;
4681
+ create?: boolean;
4682
+ namespace: Namespace;
4683
+ validNameTransformer?: (value: string) => string;
4684
+ }
4685
+
4686
+ interface ContextFile {
4687
+ /**
4688
+ * Unique file identifier.
4689
+ */
4690
+ id: string;
4691
+ /**
4692
+ * Define casing for identifiers in this file.
4693
+ */
4694
+ identifierCase?: StringCase;
4695
+ /**
4696
+ * Relative file path to the output path.
4697
+ * @example
4698
+ * 'bar/foo.ts'
4699
+ */
4700
+ path: string;
4701
+ }
4702
+ interface Events {
4703
+ /**
4704
+ * Called after parsing.
4705
+ */
4706
+ after: () => void;
4707
+ /**
4708
+ * Called before parsing.
4709
+ */
4710
+ before: () => void;
4711
+ operation: (args: {
4712
+ method: keyof IRPathItemObject;
4713
+ operation: IROperationObject;
4714
+ path: string;
4715
+ }) => void;
4716
+ parameter: (args: {
4717
+ $ref: string;
4718
+ name: string;
4719
+ parameter: IRParameterObject;
4720
+ }) => void;
4721
+ requestBody: (args: {
4722
+ $ref: string;
4723
+ name: string;
4724
+ requestBody: IRRequestBodyObject;
4725
+ }) => void;
4726
+ schema: (args: {
4727
+ $ref: string;
4728
+ name: string;
4729
+ schema: IRSchemaObject;
4730
+ }) => void;
4731
+ }
4732
+ declare class IRContext<Spec extends Record<string, any> = any> {
4733
+ /**
4734
+ * Configuration for parsing and generating the output. This
4735
+ * is a mix of user-provided and default values.
4736
+ */
4737
+ config: Config;
4738
+ /**
4739
+ * A map of files that will be generated from `spec`.
4740
+ */
4741
+ files: Files;
4742
+ /**
4743
+ * Intermediate representation model obtained from `spec`.
4744
+ */
4745
+ ir: IR;
4746
+ /**
4747
+ * Resolved specification from `input`.
4748
+ */
4749
+ spec: Spec;
4750
+ /**
4751
+ * A map of event listeners.
4752
+ */
4753
+ private listeners;
4754
+ constructor({ config, spec }: {
4755
+ config: Config;
4756
+ spec: Spec;
4757
+ });
4758
+ /**
4759
+ * Notify all event listeners about `event`.
4760
+ */
4761
+ broadcast<T extends keyof Events>(event: T, ...args: Parameters<Events[T]>): Promise<void>;
4762
+ /**
4763
+ * Create and return a new TypeScript file. Also set the current file context
4764
+ * to the newly created file.
4765
+ */
4766
+ createFile(file: ContextFile): TypeScriptFile;
4767
+ /**
4768
+ * Returns a specific file by ID from `files`.
4769
+ */
4770
+ file({ id }: Pick<ContextFile, 'id'>): TypeScriptFile | undefined;
4771
+ resolveIrRef<T>($ref: string): T;
4772
+ /**
4773
+ * Returns a resolved reference from `spec`.
4774
+ */
4775
+ resolveRef<T>($ref: string): T;
4776
+ /**
4777
+ * Register a new `event` listener.
4778
+ */
4779
+ subscribe<T extends keyof Events>(event: T, callbackFn: Events[T]): void;
4780
+ }
4412
4781
 
4413
4782
  interface Dictionary<T = unknown> {
4414
4783
  [key: string]: T;
@@ -4424,7 +4793,7 @@ interface OpenApiReference$1 {
4424
4793
  /**
4425
4794
  * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object
4426
4795
  */
4427
- interface OpenApiExample extends OpenApiReference$1 {
4796
+ interface OpenApiExample$1 extends OpenApiReference$1 {
4428
4797
  description?: string;
4429
4798
  externalValue?: string;
4430
4799
  summary?: string;
@@ -4520,20 +4889,20 @@ type MediaType = 'application/json';
4520
4889
  */
4521
4890
  interface MediaTypeObject {
4522
4891
  example?: unknown;
4523
- examples?: Dictionary<OpenApiExample>;
4892
+ examples?: Dictionary<OpenApiExample$1>;
4524
4893
  schema: OpenApiSchema$1;
4525
4894
  }
4526
4895
  /**
4527
4896
  * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object
4528
4897
  */
4529
- interface OpenApiParameter extends OpenApiReference$1 {
4898
+ interface OpenApiParameter$1 extends OpenApiReference$1 {
4530
4899
  allowEmptyValue?: boolean;
4531
4900
  allowReserved?: boolean;
4532
4901
  content?: Record<MediaType, MediaTypeObject>;
4533
4902
  deprecated?: boolean;
4534
4903
  description?: string;
4535
4904
  example?: unknown;
4536
- examples?: Dictionary<OpenApiExample>;
4905
+ examples?: Dictionary<OpenApiExample$1>;
4537
4906
  explode?: boolean;
4538
4907
  in: 'cookie' | 'formData' | 'header' | 'path' | 'query';
4539
4908
  name: string;
@@ -4633,7 +5002,7 @@ interface Model extends Schema {
4633
5002
  enums: Model[];
4634
5003
  export: 'all-of' | 'any-of' | 'array' | 'const' | 'dictionary' | 'enum' | 'generic' | 'interface' | 'one-of' | 'reference';
4635
5004
  imports: string[];
4636
- in: OperationParameter['in'] | OpenApiParameter['in'] | OperationResponse['in'] | '';
5005
+ in: OperationParameter['in'] | OpenApiParameter$1['in'] | OperationResponse['in'] | '';
4637
5006
  link: Model | Model[] | null;
4638
5007
  meta?: ModelMeta;
4639
5008
  /**
@@ -4666,10 +5035,62 @@ interface OpenApiExternalDocs {
4666
5035
  url: string;
4667
5036
  }
4668
5037
 
5038
+ /**
5039
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#contact-object
5040
+ */
5041
+ interface OpenApiContact$1 {
5042
+ email?: string;
5043
+ name?: string;
5044
+ url?: string;
5045
+ }
5046
+
5047
+ /**
5048
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#license-object
5049
+ */
5050
+ interface OpenApiLicense$1 {
5051
+ name: string;
5052
+ url?: string;
5053
+ }
5054
+
5055
+ /**
5056
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#info-object
5057
+ */
5058
+ interface OpenApiInfo$1 {
5059
+ contact?: OpenApiContact$1;
5060
+ description?: string;
5061
+ license?: OpenApiLicense$1;
5062
+ termsOfService?: string;
5063
+ title: string;
5064
+ version: string;
5065
+ }
5066
+
4669
5067
  interface WithNullableExtension {
4670
5068
  'x-nullable'?: boolean;
4671
5069
  }
4672
5070
 
5071
+ /**
5072
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#items-object)
5073
+ */
5074
+ interface OpenApiItems extends WithEnumExtension {
5075
+ collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes';
5076
+ default?: unknown;
5077
+ enum?: (string | number)[];
5078
+ exclusiveMaximum?: number;
5079
+ exclusiveMinimum?: number;
5080
+ format?: 'int32' | 'int64' | 'float' | 'double' | 'string' | 'boolean' | 'byte' | 'binary' | 'date' | 'date-time' | 'password';
5081
+ items?: OpenApiItems;
5082
+ maxItems?: number;
5083
+ maxLength?: number;
5084
+ maximum?: number;
5085
+ minItems?: number;
5086
+ minLength?: number;
5087
+ minimum?: number;
5088
+ multipleOf?: number;
5089
+ pattern?: string;
5090
+ type?: string;
5091
+ uniqueItems?: boolean;
5092
+ }
5093
+
4673
5094
  /**
4674
5095
  * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object
4675
5096
  */
@@ -4723,6 +5144,431 @@ interface OpenApiSchema extends OpenApiReference, WithEnumExtension, WithNullabl
4723
5144
  xml?: OpenApiXml;
4724
5145
  }
4725
5146
 
5147
+ /**
5148
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameter-object
5149
+ */
5150
+ interface OpenApiParameter extends OpenApiReference, WithEnumExtension, WithNullableExtension {
5151
+ allowEmptyValue?: boolean;
5152
+ collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi';
5153
+ default?: unknown;
5154
+ description?: string;
5155
+ enum?: (string | number)[];
5156
+ exclusiveMaximum?: boolean;
5157
+ exclusiveMinimum?: boolean;
5158
+ format?: 'int32' | 'int64' | 'float' | 'double' | 'string' | 'boolean' | 'byte' | 'binary' | 'date' | 'date-time' | 'password';
5159
+ in: 'path' | 'query' | 'header' | 'formData' | 'body';
5160
+ items?: OpenApiItems;
5161
+ maxItems?: number;
5162
+ maxLength?: number;
5163
+ maximum?: number;
5164
+ minItems?: number;
5165
+ minLength?: number;
5166
+ minimum?: number;
5167
+ multipleOf?: number;
5168
+ name: string;
5169
+ pattern?: string;
5170
+ required?: boolean;
5171
+ schema?: OpenApiSchema;
5172
+ type?: string;
5173
+ uniqueItems?: boolean;
5174
+ }
5175
+
5176
+ /**
5177
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#example-object
5178
+ */
5179
+ interface OpenApiExample {
5180
+ [mimetype: string]: unknown;
5181
+ }
5182
+
5183
+ /**
5184
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#header-object
5185
+ */
5186
+ interface OpenApiHeader$1 {
5187
+ collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes';
5188
+ default?: unknown;
5189
+ description?: string;
5190
+ enum?: (string | number)[];
5191
+ exclusiveMaximum?: boolean;
5192
+ exclusiveMinimum?: boolean;
5193
+ format?: 'int32' | 'int64' | 'float' | 'double' | 'string' | 'boolean' | 'byte' | 'binary' | 'date' | 'date-time' | 'password';
5194
+ items?: Dictionary<OpenApiItems>;
5195
+ maxItems?: number;
5196
+ maxLength?: number;
5197
+ maximum?: number;
5198
+ minItems?: number;
5199
+ minLength?: number;
5200
+ minimum?: number;
5201
+ multipleOf?: number;
5202
+ pattern?: string;
5203
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
5204
+ uniqueItems?: boolean;
5205
+ }
5206
+
5207
+ /**
5208
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#response-object
5209
+ */
5210
+ interface OpenApiResponse$1 extends OpenApiReference {
5211
+ description: string;
5212
+ examples?: OpenApiExample;
5213
+ headers?: Dictionary<OpenApiHeader$1>;
5214
+ schema?: OpenApiSchema & OpenApiReference;
5215
+ }
5216
+
5217
+ /**
5218
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#responses-object
5219
+ */
5220
+ interface Response$1 {
5221
+ [httpcode: string]: OpenApiResponse$1;
5222
+ }
5223
+ type OpenApiResponses$1 = Response$1 & {
5224
+ default?: OpenApiResponse$1;
5225
+ };
5226
+
5227
+ /**
5228
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#security-requirement-object
5229
+ */
5230
+ interface OpenApiSecurityRequirement$1 {
5231
+ [key: string]: string;
5232
+ }
5233
+
5234
+ /**
5235
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-object
5236
+ */
5237
+ interface OpenApiOperation$1 {
5238
+ consumes?: string[];
5239
+ deprecated?: boolean;
5240
+ description?: string;
5241
+ externalDocs?: OpenApiExternalDocs;
5242
+ operationId?: string;
5243
+ parameters?: OpenApiParameter[];
5244
+ produces?: string[];
5245
+ responses: OpenApiResponses$1;
5246
+ schemes?: ('http' | 'https' | 'ws' | 'wss')[];
5247
+ security?: OpenApiSecurityRequirement$1[];
5248
+ summary?: string;
5249
+ tags?: string[];
5250
+ }
5251
+
5252
+ /**
5253
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#path-item-object
5254
+ */
5255
+ interface OpenApiPath$1 extends OpenApiReference {
5256
+ connect?: OpenApiOperation$1;
5257
+ delete?: OpenApiOperation$1;
5258
+ get?: OpenApiOperation$1;
5259
+ head?: OpenApiOperation$1;
5260
+ options?: OpenApiOperation$1;
5261
+ parameters?: OpenApiParameter[];
5262
+ patch?: OpenApiOperation$1;
5263
+ post?: OpenApiOperation$1;
5264
+ put?: OpenApiOperation$1;
5265
+ trace?: OpenApiOperation$1;
5266
+ }
5267
+
5268
+ /**
5269
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#security-scheme-object
5270
+ */
5271
+ interface OpenApiSecurityScheme$1 {
5272
+ authorizationUrl?: string;
5273
+ description?: string;
5274
+ flow?: 'implicit' | 'password' | 'application' | 'accessCode';
5275
+ in?: 'query' | 'header';
5276
+ name?: string;
5277
+ scopes: Dictionary<string>;
5278
+ tokenUrl?: string;
5279
+ type: 'basic' | 'apiKey' | 'oauth2';
5280
+ }
5281
+
5282
+ /**
5283
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#tag-object
5284
+ */
5285
+ interface OpenApiTag$1 {
5286
+ description?: string;
5287
+ externalDocs?: OpenApiExternalDocs;
5288
+ name: string;
5289
+ }
5290
+
5291
+ /**
5292
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md
5293
+ */
5294
+ interface OpenApi$2 {
5295
+ basePath?: string;
5296
+ consumes?: string[];
5297
+ definitions?: Dictionary<OpenApiSchema>;
5298
+ externalDocs?: OpenApiExternalDocs;
5299
+ host?: string;
5300
+ info: OpenApiInfo$1;
5301
+ parameters?: Dictionary<OpenApiParameter>;
5302
+ paths: Dictionary<OpenApiPath$1>;
5303
+ produces?: string[];
5304
+ responses?: Dictionary<OpenApiResponse$1>;
5305
+ schemes?: string[];
5306
+ security?: OpenApiSecurityRequirement$1[];
5307
+ securityDefinitions?: Dictionary<OpenApiSecurityScheme$1>;
5308
+ swagger: string;
5309
+ tags?: OpenApiTag$1[];
5310
+ }
5311
+
5312
+ /**
5313
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#header-object
5314
+ */
5315
+ interface OpenApiHeader extends OpenApiReference$1 {
5316
+ allowEmptyValue?: boolean;
5317
+ allowReserved?: boolean;
5318
+ deprecated?: boolean;
5319
+ description?: string;
5320
+ example?: unknown;
5321
+ examples?: Dictionary<OpenApiExample$1>;
5322
+ explode?: boolean;
5323
+ required?: boolean;
5324
+ schema?: OpenApiSchema$1;
5325
+ style?: string;
5326
+ }
5327
+
5328
+ /**
5329
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encoding-object
5330
+ */
5331
+ interface OpenApiEncoding {
5332
+ allowReserved?: boolean;
5333
+ contentType?: string;
5334
+ explode?: boolean;
5335
+ headers?: Dictionary<OpenApiHeader>;
5336
+ style?: string;
5337
+ }
5338
+
5339
+ /**
5340
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object
5341
+ */
5342
+ interface OpenApiMediaType extends OpenApiReference$1 {
5343
+ encoding?: Dictionary<OpenApiEncoding>;
5344
+ example?: unknown;
5345
+ examples?: Dictionary<OpenApiExample$1>;
5346
+ schema?: OpenApiSchema$1;
5347
+ }
5348
+
5349
+ /**
5350
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object
5351
+ */
5352
+ interface OpenApiRequestBody extends OpenApiReference$1 {
5353
+ content: Dictionary<OpenApiMediaType>;
5354
+ description?: string;
5355
+ nullable?: boolean;
5356
+ required?: boolean;
5357
+ 'x-body-name'?: string;
5358
+ }
5359
+
5360
+ /**
5361
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-variable-object
5362
+ */
5363
+ interface OpenApiServerVariable extends WithEnumExtension {
5364
+ default: string;
5365
+ description?: string;
5366
+ enum?: (string | number)[];
5367
+ }
5368
+
5369
+ /**
5370
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object
5371
+ */
5372
+ interface OpenApiServer {
5373
+ description?: string;
5374
+ url: string;
5375
+ variables?: Dictionary<OpenApiServerVariable>;
5376
+ }
5377
+
5378
+ /**
5379
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#link-object
5380
+ */
5381
+ interface OpenApiLink extends OpenApiReference$1 {
5382
+ description?: string;
5383
+ operationId?: string;
5384
+ operationRef?: string;
5385
+ parameters?: Dictionary<unknown>;
5386
+ requestBody?: unknown;
5387
+ server?: OpenApiServer;
5388
+ }
5389
+
5390
+ /**
5391
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object
5392
+ */
5393
+ interface OpenApiResponse extends OpenApiReference$1 {
5394
+ content?: Dictionary<OpenApiMediaType>;
5395
+ description: string;
5396
+ headers?: Dictionary<OpenApiHeader>;
5397
+ links?: Dictionary<OpenApiLink>;
5398
+ }
5399
+
5400
+ /**
5401
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#responses-object
5402
+ */
5403
+ interface Response {
5404
+ [httpcode: string]: OpenApiResponse;
5405
+ }
5406
+ type OpenApiResponses = OpenApiReference$1 & Response & {
5407
+ default: OpenApiResponse;
5408
+ };
5409
+
5410
+ /**
5411
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-requirement-object
5412
+ */
5413
+ interface OpenApiSecurityRequirement {
5414
+ [name: string]: string;
5415
+ }
5416
+
5417
+ /**
5418
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object
5419
+ */
5420
+ interface OpenApiOperation {
5421
+ callbacks?: Dictionary<OpenApiCallback>;
5422
+ deprecated?: boolean;
5423
+ description?: string;
5424
+ externalDocs?: OpenApiExternalDocs$1;
5425
+ operationId?: string;
5426
+ parameters?: OpenApiParameter$1[];
5427
+ requestBody?: OpenApiRequestBody;
5428
+ responses: OpenApiResponses;
5429
+ security?: OpenApiSecurityRequirement[];
5430
+ servers?: OpenApiServer[];
5431
+ summary?: string;
5432
+ tags?: string[];
5433
+ }
5434
+
5435
+ /**
5436
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object
5437
+ */
5438
+ interface OpenApiPath {
5439
+ connect?: OpenApiOperation;
5440
+ delete?: OpenApiOperation;
5441
+ description?: string;
5442
+ get?: OpenApiOperation;
5443
+ head?: OpenApiOperation;
5444
+ options?: OpenApiOperation;
5445
+ parameters?: OpenApiParameter$1[];
5446
+ patch?: OpenApiOperation;
5447
+ post?: OpenApiOperation;
5448
+ put?: OpenApiOperation;
5449
+ servers?: OpenApiServer[];
5450
+ summary?: string;
5451
+ trace?: OpenApiOperation;
5452
+ }
5453
+
5454
+ /**
5455
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object
5456
+ */
5457
+ interface Callback {
5458
+ [key: string]: OpenApiPath;
5459
+ }
5460
+ type OpenApiCallback = OpenApiReference$1 & Callback;
5461
+
5462
+ /**
5463
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauth-flow-object
5464
+ */
5465
+ interface OpenApiOAuthFlow {
5466
+ authorizationUrl: string;
5467
+ refreshUrl?: string;
5468
+ scopes: Dictionary<string>;
5469
+ tokenUrl: string;
5470
+ }
5471
+
5472
+ /**
5473
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauth-flows-object
5474
+ */
5475
+ interface OpenApiOAuthFlows {
5476
+ authorizationCode?: OpenApiOAuthFlow;
5477
+ clientCredentials?: OpenApiOAuthFlow;
5478
+ implicit?: OpenApiOAuthFlow;
5479
+ password?: OpenApiOAuthFlow;
5480
+ }
5481
+
5482
+ /**
5483
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object
5484
+ */
5485
+ interface OpenApiSecurityScheme extends OpenApiReference$1 {
5486
+ bearerFormat?: string;
5487
+ description?: string;
5488
+ flows?: OpenApiOAuthFlows;
5489
+ in?: 'query' | 'header' | 'cookie';
5490
+ name?: string;
5491
+ openIdConnectUrl?: string;
5492
+ scheme?: string;
5493
+ type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
5494
+ }
5495
+
5496
+ /**
5497
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object
5498
+ */
5499
+ interface OpenApiComponents {
5500
+ callbacks?: Dictionary<OpenApiCallback>;
5501
+ examples?: Dictionary<OpenApiExample$1>;
5502
+ headers?: Dictionary<OpenApiHeader>;
5503
+ links?: Dictionary<OpenApiLink>;
5504
+ parameters?: Dictionary<OpenApiParameter$1>;
5505
+ requestBodies?: Dictionary<OpenApiRequestBody>;
5506
+ responses?: Dictionary<OpenApiResponses>;
5507
+ schemas?: Dictionary<OpenApiSchema$1>;
5508
+ securitySchemes?: Dictionary<OpenApiSecurityScheme>;
5509
+ }
5510
+
5511
+ /**
5512
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#contact-object
5513
+ */
5514
+ interface OpenApiContact {
5515
+ email?: string;
5516
+ name?: string;
5517
+ url?: string;
5518
+ }
5519
+
5520
+ /**
5521
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#license-object
5522
+ */
5523
+ interface OpenApiLicense {
5524
+ name: string;
5525
+ url?: string;
5526
+ }
5527
+
5528
+ /**
5529
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#info-object
5530
+ */
5531
+ interface OpenApiInfo {
5532
+ contact?: OpenApiContact;
5533
+ description?: string;
5534
+ license?: OpenApiLicense;
5535
+ termsOfService?: string;
5536
+ title: string;
5537
+ version: string;
5538
+ }
5539
+
5540
+ /**
5541
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object
5542
+ */
5543
+ interface OpenApiPaths {
5544
+ [path: string]: OpenApiPath;
5545
+ }
5546
+
5547
+ /**
5548
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object
5549
+ */
5550
+ interface OpenApiTag {
5551
+ description?: string;
5552
+ externalDocs?: OpenApiExternalDocs$1;
5553
+ name: string;
5554
+ }
5555
+
5556
+ /**
5557
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md
5558
+ */
5559
+ interface OpenApi$1 {
5560
+ components?: OpenApiComponents;
5561
+ externalDocs?: OpenApiExternalDocs$1;
5562
+ info: OpenApiInfo;
5563
+ openapi: string;
5564
+ paths: OpenApiPaths;
5565
+ security?: OpenApiSecurityRequirement[];
5566
+ servers?: OpenApiServer[];
5567
+ tags?: OpenApiTag[];
5568
+ }
5569
+
5570
+ type OpenApi = OpenApi$2 | OpenApi$1;
5571
+
4726
5572
  interface Operation extends Omit<Operation$1, 'tags'> {
4727
5573
  service: string;
4728
5574
  }
@@ -4749,4 +5595,4 @@ declare const _default: {
4749
5595
  defineConfig: (config: UserConfig) => UserConfig;
4750
5596
  };
4751
5597
 
4752
- export { type OpenApiV3_0_X, type OpenApiV3_1_X, type UserConfig, createClient, _default as default, defineConfig };
5598
+ export { type OpenApiV3_0_X, type OpenApiV3_1_X, Plugin, type UserConfig, createClient, _default as default, defineConfig };