@hey-api/openapi-ts 0.57.0 → 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.cjs +60 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +895 -31
- package/dist/index.d.ts +895 -31
- package/dist/index.js +57 -57
- package/dist/index.js.map +1 -1
- package/package.json +18 -18
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
|
|
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
|
-
|
|
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$
|
|
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,12 +3915,40 @@ 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
|
+
|
|
3929
|
+
interface IRPathsObject {
|
|
3930
|
+
[path: `/${string}`]: IRPathItemObject;
|
|
3931
|
+
}
|
|
3932
|
+
|
|
3933
|
+
interface IRPathItemObject {
|
|
3934
|
+
delete?: IROperationObject;
|
|
3935
|
+
get?: IROperationObject;
|
|
3936
|
+
head?: IROperationObject;
|
|
3937
|
+
options?: IROperationObject;
|
|
3938
|
+
patch?: IROperationObject;
|
|
3939
|
+
post?: IROperationObject;
|
|
3940
|
+
put?: IROperationObject;
|
|
3941
|
+
trace?: IROperationObject;
|
|
3942
|
+
}
|
|
3943
|
+
|
|
3836
3944
|
interface IROperationObject {
|
|
3837
3945
|
body?: IRBodyObject;
|
|
3838
3946
|
deprecated?: boolean;
|
|
3839
3947
|
description?: string;
|
|
3840
3948
|
id: string;
|
|
3949
|
+
method: keyof IRPathItemObject;
|
|
3841
3950
|
parameters?: IRParametersObject;
|
|
3951
|
+
path: keyof IRPathsObject;
|
|
3842
3952
|
responses?: IRResponsesObject;
|
|
3843
3953
|
// TODO: parser - add more properties
|
|
3844
3954
|
// security?: ReadonlyArray<SecurityRequirementObject>;
|
|
@@ -3866,7 +3976,8 @@ interface IRParametersObject {
|
|
|
3866
3976
|
query?: Record<string, IRParameterObject>;
|
|
3867
3977
|
}
|
|
3868
3978
|
|
|
3869
|
-
interface IRParameterObject
|
|
3979
|
+
interface IRParameterObject
|
|
3980
|
+
extends Pick<JsonSchemaDraft2020_12, 'deprecated' | 'description'> {
|
|
3870
3981
|
/**
|
|
3871
3982
|
* Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of `contentType` (implicit or explicit) SHALL be ignored.
|
|
3872
3983
|
*/
|
|
@@ -3900,6 +4011,12 @@ interface IRParameterObject {
|
|
|
3900
4011
|
| 'spaceDelimited';
|
|
3901
4012
|
}
|
|
3902
4013
|
|
|
4014
|
+
interface IRRequestBodyObject
|
|
4015
|
+
extends Pick<JsonSchemaDraft2020_12, 'description'> {
|
|
4016
|
+
required?: boolean;
|
|
4017
|
+
schema: IRSchemaObject;
|
|
4018
|
+
}
|
|
4019
|
+
|
|
3903
4020
|
interface IRResponsesObject {
|
|
3904
4021
|
/**
|
|
3905
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.
|
|
@@ -3984,7 +4101,7 @@ interface IRSchemaObject
|
|
|
3984
4101
|
| 'void';
|
|
3985
4102
|
}
|
|
3986
4103
|
|
|
3987
|
-
interface Config$
|
|
4104
|
+
interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
|
|
3988
4105
|
/**
|
|
3989
4106
|
* Group operation methods into classes? When enabled, you can
|
|
3990
4107
|
* select which classes to export with `sdk.include` and/or
|
|
@@ -4045,7 +4162,7 @@ interface Config$9 extends PluginName<'@hey-api/sdk'> {
|
|
|
4045
4162
|
serviceNameBuilder?: string;
|
|
4046
4163
|
}
|
|
4047
4164
|
|
|
4048
|
-
interface Config$
|
|
4165
|
+
interface Config$9 extends Plugin.Name<'@hey-api/transformers'> {
|
|
4049
4166
|
/**
|
|
4050
4167
|
* Convert date strings into Date objects?
|
|
4051
4168
|
* @default false
|
|
@@ -4058,25 +4175,43 @@ interface Config$8 extends PluginName<'@hey-api/transformers'> {
|
|
|
4058
4175
|
output?: string;
|
|
4059
4176
|
}
|
|
4060
4177
|
|
|
4061
|
-
interface Config$
|
|
4178
|
+
interface Config$8 extends Plugin.Name<'@hey-api/typescript'> {
|
|
4062
4179
|
/**
|
|
4063
4180
|
* By default, enums are generated as TypeScript types. In addition to that,
|
|
4064
4181
|
* you can choose to generate them as JavaScript objects, TypeScript enums,
|
|
4065
4182
|
* or TypeScript enums contained within namespaces.
|
|
4183
|
+
*
|
|
4066
4184
|
* @default false
|
|
4067
4185
|
*/
|
|
4068
4186
|
enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false;
|
|
4069
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
|
+
*
|
|
4070
4199
|
* By default, inline enums (enums not defined as reusable components in
|
|
4071
4200
|
* the input file) are generated as inlined union types. You can set
|
|
4072
4201
|
* `exportInlineEnums` to `true` to treat inline enums as reusable components.
|
|
4073
4202
|
* When `true`, the exported enums will follow the style defined in `enums`.
|
|
4074
4203
|
*
|
|
4075
|
-
* This option works only with the experimental parser.
|
|
4076
|
-
*
|
|
4077
4204
|
* @default false
|
|
4078
4205
|
*/
|
|
4079
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'>;
|
|
4080
4215
|
/**
|
|
4081
4216
|
* Include only types matching regular expression.
|
|
4082
4217
|
*
|
|
@@ -4091,13 +4226,21 @@ interface Config$7 extends PluginName<'@hey-api/typescript'> {
|
|
|
4091
4226
|
*/
|
|
4092
4227
|
output?: string;
|
|
4093
4228
|
/**
|
|
4229
|
+
* **This feature works only with the legacy parser**
|
|
4230
|
+
*
|
|
4094
4231
|
* Use your preferred naming pattern
|
|
4232
|
+
*
|
|
4095
4233
|
* @default 'preserve'
|
|
4234
|
+
*
|
|
4235
|
+
* @deprecated
|
|
4096
4236
|
*/
|
|
4097
4237
|
style?: 'PascalCase' | 'preserve';
|
|
4098
4238
|
/**
|
|
4239
|
+
* **This feature works only with the legacy parser**
|
|
4240
|
+
*
|
|
4099
4241
|
* Generate a tree of types containing all operations? It will be named
|
|
4100
4242
|
* $OpenApiTs.
|
|
4243
|
+
*
|
|
4101
4244
|
* @default false
|
|
4102
4245
|
*
|
|
4103
4246
|
* @deprecated
|
|
@@ -4105,8 +4248,8 @@ interface Config$7 extends PluginName<'@hey-api/typescript'> {
|
|
|
4105
4248
|
tree?: boolean;
|
|
4106
4249
|
}
|
|
4107
4250
|
|
|
4108
|
-
interface Config$
|
|
4109
|
-
extends
|
|
4251
|
+
interface Config$7
|
|
4252
|
+
extends Plugin.Name<'@tanstack/angular-query-experimental'> {
|
|
4110
4253
|
/**
|
|
4111
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.
|
|
4112
4255
|
* @default true
|
|
@@ -4130,7 +4273,7 @@ interface Config$6
|
|
|
4130
4273
|
queryOptions?: boolean;
|
|
4131
4274
|
}
|
|
4132
4275
|
|
|
4133
|
-
interface Config$
|
|
4276
|
+
interface Config$6 extends Plugin.Name<'@tanstack/react-query'> {
|
|
4134
4277
|
/**
|
|
4135
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.
|
|
4136
4279
|
* @default true
|
|
@@ -4154,7 +4297,7 @@ interface Config$5 extends PluginName<'@tanstack/react-query'> {
|
|
|
4154
4297
|
queryOptions?: boolean;
|
|
4155
4298
|
}
|
|
4156
4299
|
|
|
4157
|
-
interface Config$
|
|
4300
|
+
interface Config$5 extends Plugin.Name<'@tanstack/solid-query'> {
|
|
4158
4301
|
/**
|
|
4159
4302
|
* Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
|
|
4160
4303
|
* @default true
|
|
@@ -4178,7 +4321,7 @@ interface Config$4 extends PluginName<'@tanstack/solid-query'> {
|
|
|
4178
4321
|
queryOptions?: boolean;
|
|
4179
4322
|
}
|
|
4180
4323
|
|
|
4181
|
-
interface Config$
|
|
4324
|
+
interface Config$4 extends Plugin.Name<'@tanstack/svelte-query'> {
|
|
4182
4325
|
/**
|
|
4183
4326
|
* Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
|
|
4184
4327
|
* @default true
|
|
@@ -4202,7 +4345,7 @@ interface Config$3 extends PluginName<'@tanstack/svelte-query'> {
|
|
|
4202
4345
|
queryOptions?: boolean;
|
|
4203
4346
|
}
|
|
4204
4347
|
|
|
4205
|
-
interface Config$
|
|
4348
|
+
interface Config$3 extends Plugin.Name<'@tanstack/vue-query'> {
|
|
4206
4349
|
/**
|
|
4207
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.
|
|
4208
4351
|
* @default true
|
|
@@ -4226,7 +4369,7 @@ interface Config$2 extends PluginName<'@tanstack/vue-query'> {
|
|
|
4226
4369
|
queryOptions?: boolean;
|
|
4227
4370
|
}
|
|
4228
4371
|
|
|
4229
|
-
interface Config$
|
|
4372
|
+
interface Config$2 extends Plugin.Name<'fastify'> {
|
|
4230
4373
|
/**
|
|
4231
4374
|
* Name of the generated file.
|
|
4232
4375
|
* @default 'fastify'
|
|
@@ -4237,7 +4380,7 @@ interface Config$1 extends PluginName<'fastify'> {
|
|
|
4237
4380
|
// import type { IROperationObject, IRSchemaObject } from '../../ir/ir';
|
|
4238
4381
|
|
|
4239
4382
|
|
|
4240
|
-
interface Config extends
|
|
4383
|
+
interface Config$1 extends Plugin.Name<'zod'> {
|
|
4241
4384
|
/**
|
|
4242
4385
|
* Customise the Zod schema name. By default, `z{{name}}` is used,
|
|
4243
4386
|
* where `name` is a definition name or an operation name.
|
|
@@ -4253,13 +4396,21 @@ interface Config extends PluginName<'zod'> {
|
|
|
4253
4396
|
/**
|
|
4254
4397
|
* User-facing plugin types.
|
|
4255
4398
|
*/
|
|
4256
|
-
type UserPlugins = UserConfig$
|
|
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>;
|
|
4257
4404
|
|
|
4258
4405
|
declare const CLIENTS: readonly ["@hey-api/client-axios", "@hey-api/client-fetch", "legacy/angular", "legacy/axios", "legacy/fetch", "legacy/node", "legacy/xhr"];
|
|
4259
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';
|
|
4260
4410
|
interface ClientConfig {
|
|
4261
4411
|
/**
|
|
4262
4412
|
* Manually set base in OpenAPI config instead of inferring from server value
|
|
4413
|
+
*
|
|
4263
4414
|
* @deprecated
|
|
4264
4415
|
*/
|
|
4265
4416
|
base?: string;
|
|
@@ -4274,6 +4425,7 @@ interface ClientConfig {
|
|
|
4274
4425
|
* package and bundled with the rest of the generated output. This is
|
|
4275
4426
|
* useful if you're repackaging the output, publishing it to other users,
|
|
4276
4427
|
* and you don't want them to install any dependencies.
|
|
4428
|
+
*
|
|
4277
4429
|
* @default false
|
|
4278
4430
|
*/
|
|
4279
4431
|
bundle?: boolean;
|
|
@@ -4289,21 +4441,25 @@ interface ClientConfig {
|
|
|
4289
4441
|
configFile?: string;
|
|
4290
4442
|
/**
|
|
4291
4443
|
* Run in debug mode?
|
|
4444
|
+
*
|
|
4292
4445
|
* @default false
|
|
4293
4446
|
*/
|
|
4294
4447
|
debug?: boolean;
|
|
4295
4448
|
/**
|
|
4296
4449
|
* Skip writing files to disk?
|
|
4450
|
+
*
|
|
4297
4451
|
* @default false
|
|
4298
4452
|
*/
|
|
4299
4453
|
dryRun?: boolean;
|
|
4300
4454
|
/**
|
|
4301
|
-
* Opt
|
|
4455
|
+
* Opt in to the experimental parser?
|
|
4456
|
+
*
|
|
4302
4457
|
* @default false
|
|
4303
4458
|
*/
|
|
4304
4459
|
experimentalParser?: boolean;
|
|
4305
4460
|
/**
|
|
4306
4461
|
* Generate core client classes?
|
|
4462
|
+
*
|
|
4307
4463
|
* @default true
|
|
4308
4464
|
*/
|
|
4309
4465
|
exportCore?: boolean;
|
|
@@ -4316,6 +4472,8 @@ interface ClientConfig {
|
|
|
4316
4472
|
*/
|
|
4317
4473
|
input: string | Record<string, unknown> | {
|
|
4318
4474
|
/**
|
|
4475
|
+
* **This feature works only with the experimental parser**
|
|
4476
|
+
*
|
|
4319
4477
|
* Prevent parts matching the regular expression from being processed.
|
|
4320
4478
|
* You can select both operations and components by reference within
|
|
4321
4479
|
* the bundled input. In case of conflicts, `exclude` takes precedence
|
|
@@ -4327,6 +4485,8 @@ interface ClientConfig {
|
|
|
4327
4485
|
*/
|
|
4328
4486
|
exclude?: string;
|
|
4329
4487
|
/**
|
|
4488
|
+
* **This feature works only with the experimental parser**
|
|
4489
|
+
|
|
4330
4490
|
* Process only parts matching the regular expression. You can select both
|
|
4331
4491
|
* operations and components by reference within the bundled input. In
|
|
4332
4492
|
* case of conflicts, `exclude` takes precedence over `include`.
|
|
@@ -4346,7 +4506,9 @@ interface ClientConfig {
|
|
|
4346
4506
|
/**
|
|
4347
4507
|
* Custom client class name. Please note this option is deprecated and
|
|
4348
4508
|
* will be removed in favor of clients.
|
|
4509
|
+
*
|
|
4349
4510
|
* @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name
|
|
4511
|
+
*
|
|
4350
4512
|
* @deprecated
|
|
4351
4513
|
*/
|
|
4352
4514
|
name?: string;
|
|
@@ -4354,16 +4516,36 @@ interface ClientConfig {
|
|
|
4354
4516
|
* The relative location of the output folder
|
|
4355
4517
|
*/
|
|
4356
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;
|
|
4357
4537
|
/**
|
|
4358
4538
|
* Process output folder with formatter?
|
|
4539
|
+
*
|
|
4359
4540
|
* @default false
|
|
4360
4541
|
*/
|
|
4361
|
-
format?:
|
|
4542
|
+
format?: Formatters | false;
|
|
4362
4543
|
/**
|
|
4363
4544
|
* Process output folder with linter?
|
|
4545
|
+
*
|
|
4364
4546
|
* @default false
|
|
4365
4547
|
*/
|
|
4366
|
-
lint?:
|
|
4548
|
+
lint?: Linters | false;
|
|
4367
4549
|
/**
|
|
4368
4550
|
* The relative location of the output folder
|
|
4369
4551
|
*/
|
|
@@ -4376,21 +4558,226 @@ interface ClientConfig {
|
|
|
4376
4558
|
/**
|
|
4377
4559
|
* Path to custom request file. Please note this option is deprecated and
|
|
4378
4560
|
* will be removed in favor of clients.
|
|
4561
|
+
*
|
|
4379
4562
|
* @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-request
|
|
4563
|
+
*
|
|
4380
4564
|
* @deprecated
|
|
4381
4565
|
*/
|
|
4382
4566
|
request?: string;
|
|
4383
4567
|
/**
|
|
4384
4568
|
* Use options or arguments functions. Please note this option is deprecated and
|
|
4385
4569
|
* will be removed in favor of clients.
|
|
4570
|
+
*
|
|
4386
4571
|
* @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-useoptions
|
|
4572
|
+
*
|
|
4387
4573
|
* @deprecated
|
|
4574
|
+
*
|
|
4388
4575
|
* @default true
|
|
4389
4576
|
*/
|
|
4390
4577
|
useOptions?: boolean;
|
|
4391
4578
|
}
|
|
4392
4579
|
interface UserConfig extends ClientConfig {
|
|
4393
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
|
+
}
|
|
4394
4781
|
|
|
4395
4782
|
interface Dictionary<T = unknown> {
|
|
4396
4783
|
[key: string]: T;
|
|
@@ -4406,7 +4793,7 @@ interface OpenApiReference$1 {
|
|
|
4406
4793
|
/**
|
|
4407
4794
|
* {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object
|
|
4408
4795
|
*/
|
|
4409
|
-
interface OpenApiExample extends OpenApiReference$1 {
|
|
4796
|
+
interface OpenApiExample$1 extends OpenApiReference$1 {
|
|
4410
4797
|
description?: string;
|
|
4411
4798
|
externalValue?: string;
|
|
4412
4799
|
summary?: string;
|
|
@@ -4502,20 +4889,20 @@ type MediaType = 'application/json';
|
|
|
4502
4889
|
*/
|
|
4503
4890
|
interface MediaTypeObject {
|
|
4504
4891
|
example?: unknown;
|
|
4505
|
-
examples?: Dictionary<OpenApiExample>;
|
|
4892
|
+
examples?: Dictionary<OpenApiExample$1>;
|
|
4506
4893
|
schema: OpenApiSchema$1;
|
|
4507
4894
|
}
|
|
4508
4895
|
/**
|
|
4509
4896
|
* {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object
|
|
4510
4897
|
*/
|
|
4511
|
-
interface OpenApiParameter extends OpenApiReference$1 {
|
|
4898
|
+
interface OpenApiParameter$1 extends OpenApiReference$1 {
|
|
4512
4899
|
allowEmptyValue?: boolean;
|
|
4513
4900
|
allowReserved?: boolean;
|
|
4514
4901
|
content?: Record<MediaType, MediaTypeObject>;
|
|
4515
4902
|
deprecated?: boolean;
|
|
4516
4903
|
description?: string;
|
|
4517
4904
|
example?: unknown;
|
|
4518
|
-
examples?: Dictionary<OpenApiExample>;
|
|
4905
|
+
examples?: Dictionary<OpenApiExample$1>;
|
|
4519
4906
|
explode?: boolean;
|
|
4520
4907
|
in: 'cookie' | 'formData' | 'header' | 'path' | 'query';
|
|
4521
4908
|
name: string;
|
|
@@ -4615,7 +5002,7 @@ interface Model extends Schema {
|
|
|
4615
5002
|
enums: Model[];
|
|
4616
5003
|
export: 'all-of' | 'any-of' | 'array' | 'const' | 'dictionary' | 'enum' | 'generic' | 'interface' | 'one-of' | 'reference';
|
|
4617
5004
|
imports: string[];
|
|
4618
|
-
in: OperationParameter['in'] | OpenApiParameter['in'] | OperationResponse['in'] | '';
|
|
5005
|
+
in: OperationParameter['in'] | OpenApiParameter$1['in'] | OperationResponse['in'] | '';
|
|
4619
5006
|
link: Model | Model[] | null;
|
|
4620
5007
|
meta?: ModelMeta;
|
|
4621
5008
|
/**
|
|
@@ -4648,10 +5035,62 @@ interface OpenApiExternalDocs {
|
|
|
4648
5035
|
url: string;
|
|
4649
5036
|
}
|
|
4650
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
|
+
|
|
4651
5067
|
interface WithNullableExtension {
|
|
4652
5068
|
'x-nullable'?: boolean;
|
|
4653
5069
|
}
|
|
4654
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
|
+
|
|
4655
5094
|
/**
|
|
4656
5095
|
* {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object
|
|
4657
5096
|
*/
|
|
@@ -4705,6 +5144,431 @@ interface OpenApiSchema extends OpenApiReference, WithEnumExtension, WithNullabl
|
|
|
4705
5144
|
xml?: OpenApiXml;
|
|
4706
5145
|
}
|
|
4707
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
|
+
|
|
4708
5572
|
interface Operation extends Omit<Operation$1, 'tags'> {
|
|
4709
5573
|
service: string;
|
|
4710
5574
|
}
|
|
@@ -4731,4 +5595,4 @@ declare const _default: {
|
|
|
4731
5595
|
defineConfig: (config: UserConfig) => UserConfig;
|
|
4732
5596
|
};
|
|
4733
5597
|
|
|
4734
|
-
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 };
|