@kubb/plugin-oas 4.31.0 → 4.31.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "4.31.
|
|
3
|
+
"version": "4.31.1",
|
|
4
4
|
"description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -81,13 +81,13 @@
|
|
|
81
81
|
}
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@kubb/react-fabric": "0.13.
|
|
84
|
+
"@kubb/react-fabric": "0.13.3",
|
|
85
85
|
"remeda": "^2.33.6",
|
|
86
|
-
"@kubb/core": "4.31.
|
|
87
|
-
"@kubb/oas": "4.31.
|
|
86
|
+
"@kubb/core": "4.31.1",
|
|
87
|
+
"@kubb/oas": "4.31.1"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@kubb/react-fabric": "0.13.
|
|
90
|
+
"@kubb/react-fabric": "0.13.3"
|
|
91
91
|
},
|
|
92
92
|
"engines": {
|
|
93
93
|
"node": ">=20"
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
2
|
-
import { SchemaObject } from "@kubb/oas";
|
|
3
|
-
|
|
4
|
-
//#region \0rolldown/runtime.js
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/SchemaMapper.d.ts
|
|
7
|
-
type SchemaKeywordMapper = {
|
|
8
|
-
object: {
|
|
9
|
-
keyword: 'object';
|
|
10
|
-
args: {
|
|
11
|
-
properties: {
|
|
12
|
-
[x: string]: Schema[];
|
|
13
|
-
};
|
|
14
|
-
additionalProperties: Schema[];
|
|
15
|
-
patternProperties?: Record<string, Schema[]>;
|
|
16
|
-
strict?: boolean;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
url: {
|
|
20
|
-
keyword: 'url';
|
|
21
|
-
};
|
|
22
|
-
readOnly: {
|
|
23
|
-
keyword: 'readOnly';
|
|
24
|
-
};
|
|
25
|
-
writeOnly: {
|
|
26
|
-
keyword: 'writeOnly';
|
|
27
|
-
};
|
|
28
|
-
uuid: {
|
|
29
|
-
keyword: 'uuid';
|
|
30
|
-
};
|
|
31
|
-
email: {
|
|
32
|
-
keyword: 'email';
|
|
33
|
-
};
|
|
34
|
-
firstName: {
|
|
35
|
-
keyword: 'firstName';
|
|
36
|
-
};
|
|
37
|
-
lastName: {
|
|
38
|
-
keyword: 'lastName';
|
|
39
|
-
};
|
|
40
|
-
phone: {
|
|
41
|
-
keyword: 'phone';
|
|
42
|
-
};
|
|
43
|
-
password: {
|
|
44
|
-
keyword: 'password';
|
|
45
|
-
};
|
|
46
|
-
date: {
|
|
47
|
-
keyword: 'date';
|
|
48
|
-
args: {
|
|
49
|
-
type?: 'date' | 'string';
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
time: {
|
|
53
|
-
keyword: 'time';
|
|
54
|
-
args: {
|
|
55
|
-
type?: 'date' | 'string';
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
datetime: {
|
|
59
|
-
keyword: 'datetime';
|
|
60
|
-
args: {
|
|
61
|
-
offset?: boolean;
|
|
62
|
-
local?: boolean;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
tuple: {
|
|
66
|
-
keyword: 'tuple';
|
|
67
|
-
args: {
|
|
68
|
-
items: Schema[];
|
|
69
|
-
min?: number;
|
|
70
|
-
max?: number;
|
|
71
|
-
rest?: Schema;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
array: {
|
|
75
|
-
keyword: 'array';
|
|
76
|
-
args: {
|
|
77
|
-
items: Schema[];
|
|
78
|
-
min?: number;
|
|
79
|
-
max?: number;
|
|
80
|
-
unique?: boolean;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
enum: {
|
|
84
|
-
keyword: 'enum';
|
|
85
|
-
args: {
|
|
86
|
-
name: string;
|
|
87
|
-
typeName: string;
|
|
88
|
-
asConst: boolean;
|
|
89
|
-
items: Array<{
|
|
90
|
-
name: string | number;
|
|
91
|
-
format: 'string' | 'number' | 'boolean';
|
|
92
|
-
value?: string | number | boolean;
|
|
93
|
-
}>;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
and: {
|
|
97
|
-
keyword: 'and';
|
|
98
|
-
args: Schema[];
|
|
99
|
-
};
|
|
100
|
-
const: {
|
|
101
|
-
keyword: 'const';
|
|
102
|
-
args: {
|
|
103
|
-
name: string | number;
|
|
104
|
-
format: 'string' | 'number' | 'boolean';
|
|
105
|
-
value?: string | number | boolean;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
union: {
|
|
109
|
-
keyword: 'union';
|
|
110
|
-
args: Schema[];
|
|
111
|
-
};
|
|
112
|
-
ref: {
|
|
113
|
-
keyword: 'ref';
|
|
114
|
-
args: {
|
|
115
|
-
name: string;
|
|
116
|
-
$ref: string;
|
|
117
|
-
/**
|
|
118
|
-
* Full qualified path.
|
|
119
|
-
*/
|
|
120
|
-
path: KubbFile.Path;
|
|
121
|
-
/**
|
|
122
|
-
* When true `File.Import` is used.
|
|
123
|
-
* When false a reference is used inside the current file.
|
|
124
|
-
*/
|
|
125
|
-
isImportable: boolean;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
matches: {
|
|
129
|
-
keyword: 'matches';
|
|
130
|
-
args?: string;
|
|
131
|
-
};
|
|
132
|
-
boolean: {
|
|
133
|
-
keyword: 'boolean';
|
|
134
|
-
};
|
|
135
|
-
default: {
|
|
136
|
-
keyword: 'default';
|
|
137
|
-
args: string | number | boolean;
|
|
138
|
-
};
|
|
139
|
-
string: {
|
|
140
|
-
keyword: 'string';
|
|
141
|
-
};
|
|
142
|
-
integer: {
|
|
143
|
-
keyword: 'integer';
|
|
144
|
-
};
|
|
145
|
-
bigint: {
|
|
146
|
-
keyword: 'bigint';
|
|
147
|
-
};
|
|
148
|
-
number: {
|
|
149
|
-
keyword: 'number';
|
|
150
|
-
};
|
|
151
|
-
max: {
|
|
152
|
-
keyword: 'max';
|
|
153
|
-
args: number;
|
|
154
|
-
};
|
|
155
|
-
min: {
|
|
156
|
-
keyword: 'min';
|
|
157
|
-
args: number;
|
|
158
|
-
};
|
|
159
|
-
exclusiveMaximum: {
|
|
160
|
-
keyword: 'exclusiveMaximum';
|
|
161
|
-
args: number;
|
|
162
|
-
};
|
|
163
|
-
exclusiveMinimum: {
|
|
164
|
-
keyword: 'exclusiveMinimum';
|
|
165
|
-
args: number;
|
|
166
|
-
};
|
|
167
|
-
describe: {
|
|
168
|
-
keyword: 'describe';
|
|
169
|
-
args: string;
|
|
170
|
-
};
|
|
171
|
-
example: {
|
|
172
|
-
keyword: 'example';
|
|
173
|
-
args: string;
|
|
174
|
-
};
|
|
175
|
-
deprecated: {
|
|
176
|
-
keyword: 'deprecated';
|
|
177
|
-
};
|
|
178
|
-
optional: {
|
|
179
|
-
keyword: 'optional';
|
|
180
|
-
};
|
|
181
|
-
undefined: {
|
|
182
|
-
keyword: 'undefined';
|
|
183
|
-
};
|
|
184
|
-
nullish: {
|
|
185
|
-
keyword: 'nullish';
|
|
186
|
-
};
|
|
187
|
-
nullable: {
|
|
188
|
-
keyword: 'nullable';
|
|
189
|
-
};
|
|
190
|
-
null: {
|
|
191
|
-
keyword: 'null';
|
|
192
|
-
};
|
|
193
|
-
any: {
|
|
194
|
-
keyword: 'any';
|
|
195
|
-
};
|
|
196
|
-
unknown: {
|
|
197
|
-
keyword: 'unknown';
|
|
198
|
-
};
|
|
199
|
-
void: {
|
|
200
|
-
keyword: 'void';
|
|
201
|
-
};
|
|
202
|
-
blob: {
|
|
203
|
-
keyword: 'blob';
|
|
204
|
-
};
|
|
205
|
-
schema: {
|
|
206
|
-
keyword: 'schema';
|
|
207
|
-
args: {
|
|
208
|
-
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
209
|
-
format?: string;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
name: {
|
|
213
|
-
keyword: 'name';
|
|
214
|
-
args: string;
|
|
215
|
-
};
|
|
216
|
-
catchall: {
|
|
217
|
-
keyword: 'catchall';
|
|
218
|
-
};
|
|
219
|
-
interface: {
|
|
220
|
-
keyword: 'interface';
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
declare const schemaKeywords: {
|
|
224
|
-
any: "any";
|
|
225
|
-
unknown: "unknown";
|
|
226
|
-
number: "number";
|
|
227
|
-
integer: "integer";
|
|
228
|
-
bigint: "bigint";
|
|
229
|
-
string: "string";
|
|
230
|
-
boolean: "boolean";
|
|
231
|
-
undefined: "undefined";
|
|
232
|
-
nullable: "nullable";
|
|
233
|
-
null: "null";
|
|
234
|
-
nullish: "nullish";
|
|
235
|
-
array: "array";
|
|
236
|
-
tuple: "tuple";
|
|
237
|
-
enum: "enum";
|
|
238
|
-
union: "union";
|
|
239
|
-
datetime: "datetime";
|
|
240
|
-
date: "date";
|
|
241
|
-
email: "email";
|
|
242
|
-
uuid: "uuid";
|
|
243
|
-
url: "url";
|
|
244
|
-
void: "void";
|
|
245
|
-
default: "default";
|
|
246
|
-
const: "const";
|
|
247
|
-
and: "and";
|
|
248
|
-
describe: "describe";
|
|
249
|
-
min: "min";
|
|
250
|
-
max: "max";
|
|
251
|
-
exclusiveMinimum: "exclusiveMinimum";
|
|
252
|
-
exclusiveMaximum: "exclusiveMaximum";
|
|
253
|
-
optional: "optional";
|
|
254
|
-
readOnly: "readOnly";
|
|
255
|
-
writeOnly: "writeOnly";
|
|
256
|
-
object: "object";
|
|
257
|
-
ref: "ref";
|
|
258
|
-
matches: "matches";
|
|
259
|
-
firstName: "firstName";
|
|
260
|
-
lastName: "lastName";
|
|
261
|
-
password: "password";
|
|
262
|
-
phone: "phone";
|
|
263
|
-
blob: "blob";
|
|
264
|
-
deprecated: "deprecated";
|
|
265
|
-
example: "example";
|
|
266
|
-
schema: "schema";
|
|
267
|
-
catchall: "catchall";
|
|
268
|
-
time: "time";
|
|
269
|
-
name: "name";
|
|
270
|
-
interface: "interface";
|
|
271
|
-
};
|
|
272
|
-
type SchemaKeyword = keyof SchemaKeywordMapper;
|
|
273
|
-
type SchemaMapper<T = string | null | undefined> = { [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined };
|
|
274
|
-
type SchemaKeywordBase<T> = {
|
|
275
|
-
keyword: SchemaKeyword;
|
|
276
|
-
args: T;
|
|
277
|
-
};
|
|
278
|
-
type Schema = {
|
|
279
|
-
keyword: string;
|
|
280
|
-
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
281
|
-
type SchemaTree = {
|
|
282
|
-
schema: SchemaObject;
|
|
283
|
-
parent: Schema | undefined;
|
|
284
|
-
current: Schema;
|
|
285
|
-
siblings: Schema[];
|
|
286
|
-
/**
|
|
287
|
-
* this is equal to the key of a property(object)
|
|
288
|
-
*/
|
|
289
|
-
name?: string;
|
|
290
|
-
};
|
|
291
|
-
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
292
|
-
//#endregion
|
|
293
|
-
export { SchemaMapper as a, schemaKeywords as c, SchemaKeywordMapper as i, __name as l, SchemaKeyword as n, SchemaTree as o, SchemaKeywordBase as r, isKeyword as s, Schema as t };
|
|
294
|
-
//# sourceMappingURL=SchemaMapper-nkCtMfTV.d.ts.map
|
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
import { i as SchemaKeywordMapper, l as __name, t as Schema } from "./SchemaMapper-nkCtMfTV.js";
|
|
2
|
-
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
3
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
-
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
5
|
-
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
6
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
7
|
-
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
8
|
-
|
|
9
|
-
//#region src/types.d.ts
|
|
10
|
-
type GetOasOptions = {
|
|
11
|
-
validate?: boolean;
|
|
12
|
-
};
|
|
13
|
-
type Context$2 = {
|
|
14
|
-
getOas(options?: GetOasOptions): Promise<Oas>;
|
|
15
|
-
getBaseURL(): Promise<string | undefined>;
|
|
16
|
-
};
|
|
17
|
-
declare global {
|
|
18
|
-
namespace Kubb {
|
|
19
|
-
interface PluginContext extends Context$2 {}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
type ResolvePathOptions = {
|
|
23
|
-
pluginKey?: Plugin['key'];
|
|
24
|
-
group?: {
|
|
25
|
-
tag?: string;
|
|
26
|
-
path?: string;
|
|
27
|
-
};
|
|
28
|
-
type?: ResolveNameParams['type'];
|
|
29
|
-
};
|
|
30
|
-
type Options = {
|
|
31
|
-
/**
|
|
32
|
-
* Validate your input(see kubb.config) based on '@readme/openapi-parser'.
|
|
33
|
-
* @default true
|
|
34
|
-
*/
|
|
35
|
-
validate?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Specify the export location for the files and define the behavior of the output
|
|
38
|
-
* @default { path: 'schemas', barrelType: 'named' }
|
|
39
|
-
*/
|
|
40
|
-
output?: Output<Oas>;
|
|
41
|
-
/**
|
|
42
|
-
* Group the JSON files based on the provided name.
|
|
43
|
-
*/
|
|
44
|
-
group?: Group;
|
|
45
|
-
/**
|
|
46
|
-
* Which server to use from the array of `servers.url[serverIndex]`
|
|
47
|
-
* @example
|
|
48
|
-
* - `0` returns `http://petstore.swagger.io/api`
|
|
49
|
-
* - `1` returns `http://localhost:3000`
|
|
50
|
-
*/
|
|
51
|
-
serverIndex?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Define which contentType should be used.
|
|
54
|
-
* By default, uses the first valid JSON media type.
|
|
55
|
-
*/
|
|
56
|
-
contentType?: contentType;
|
|
57
|
-
/**
|
|
58
|
-
* Defines how the discriminator value should be interpreted during processing.
|
|
59
|
-
* - 'strict' uses the oneOf schemas as defined, without modification.
|
|
60
|
-
* - 'inherit' replaces the oneOf schema with the schema referenced by discriminator.mapping[key].
|
|
61
|
-
* @default 'strict'
|
|
62
|
-
* @see https://github.com/kubb-labs/kubb/issues/1736
|
|
63
|
-
*/
|
|
64
|
-
discriminator?: 'strict' | 'inherit';
|
|
65
|
-
/**
|
|
66
|
-
* Override some behavior of the Oas class instance, see '@kubb/oas'
|
|
67
|
-
*/
|
|
68
|
-
oasClass?: typeof Oas;
|
|
69
|
-
/**
|
|
70
|
-
* Define some generators next to the JSON generation
|
|
71
|
-
*/
|
|
72
|
-
generators?: Array<Generator<PluginOas>>;
|
|
73
|
-
/**
|
|
74
|
-
* Resolve name collisions when schemas from different components share the same name (case-insensitive).
|
|
75
|
-
*
|
|
76
|
-
* When enabled, Kubb automatically detects and resolves collisions using intelligent suffixes:
|
|
77
|
-
* - Cross-component collisions: Adds semantic suffixes based on the component type (Schema/Response/Request)
|
|
78
|
-
* - Same-component collisions: Adds numeric suffixes (2, 3, ...) for case-insensitive duplicates
|
|
79
|
-
* - Nested enum collisions: Includes root schema name in enum names to prevent duplicates across schemas
|
|
80
|
-
*
|
|
81
|
-
* When disabled (legacy behavior), collisions may result in duplicate files or overwrite issues.
|
|
82
|
-
*
|
|
83
|
-
* **Cross-component collision example:**
|
|
84
|
-
* If you have "Order" in both schemas and requestBodies:
|
|
85
|
-
* - With `collisionDetection: true`: Generates `OrderSchema.ts`, `OrderRequest.ts`
|
|
86
|
-
* - With `collisionDetection: false`: May generate duplicate `Order.ts` files
|
|
87
|
-
*
|
|
88
|
-
* **Same-component collision example:**
|
|
89
|
-
* If you have "Variant" and "variant" in schemas:
|
|
90
|
-
* - With `collisionDetection: true`: Generates `Variant.ts`, `Variant2.ts`
|
|
91
|
-
* - With `collisionDetection: false`: May overwrite or create duplicates
|
|
92
|
-
*
|
|
93
|
-
* **Nested enum collision example:**
|
|
94
|
-
* If you have "params.channel" enum in both "NotificationTypeA" and "NotificationTypeB":
|
|
95
|
-
* - With `collisionDetection: true`: Generates `notificationTypeAParamsChannelEnum`, `notificationTypeBParamsChannelEnum`
|
|
96
|
-
* - With `collisionDetection: false`: Generates duplicate `paramsChannelEnum` in both files
|
|
97
|
-
*
|
|
98
|
-
* @default false (will be `true` in v5)
|
|
99
|
-
* @see https://github.com/kubb-labs/kubb/issues/1999
|
|
100
|
-
* @note In Kubb v5, this will be enabled by default and the deprecated `usedEnumNames` mechanism will be removed
|
|
101
|
-
*/
|
|
102
|
-
collisionDetection?: boolean;
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* `propertyName` is the ref name + resolved with the nameResolver
|
|
106
|
-
* @example import { Pet } from './Pet'
|
|
107
|
-
*
|
|
108
|
-
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
109
|
-
*
|
|
110
|
-
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
111
|
-
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
112
|
-
*/
|
|
113
|
-
type Ref = {
|
|
114
|
-
propertyName: string;
|
|
115
|
-
originalName: string;
|
|
116
|
-
path: KubbFile.Path;
|
|
117
|
-
pluginKey?: Plugin['key'];
|
|
118
|
-
};
|
|
119
|
-
type Refs = Record<string, Ref>;
|
|
120
|
-
type Resolver = {
|
|
121
|
-
/**
|
|
122
|
-
* Original name or name resolved by `resolveName({ name: operation?.getOperationId() as string, pluginName })`
|
|
123
|
-
*/
|
|
124
|
-
name: string;
|
|
125
|
-
baseName: KubbFile.BaseName;
|
|
126
|
-
path: KubbFile.Path;
|
|
127
|
-
};
|
|
128
|
-
type OperationSchema = {
|
|
129
|
-
/**
|
|
130
|
-
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
131
|
-
*/
|
|
132
|
-
name: string;
|
|
133
|
-
schema: SchemaObject;
|
|
134
|
-
operation?: Operation;
|
|
135
|
-
/**
|
|
136
|
-
* OperationName in PascalCase, only being used in OperationGenerator
|
|
137
|
-
*/
|
|
138
|
-
operationName: string;
|
|
139
|
-
description?: string;
|
|
140
|
-
statusCode?: number;
|
|
141
|
-
keys?: string[];
|
|
142
|
-
keysToOmit?: string[];
|
|
143
|
-
withData?: boolean;
|
|
144
|
-
};
|
|
145
|
-
type OperationSchemas = {
|
|
146
|
-
pathParams?: OperationSchema & {
|
|
147
|
-
keysToOmit?: never;
|
|
148
|
-
};
|
|
149
|
-
queryParams?: OperationSchema & {
|
|
150
|
-
keysToOmit?: never;
|
|
151
|
-
};
|
|
152
|
-
headerParams?: OperationSchema & {
|
|
153
|
-
keysToOmit?: never;
|
|
154
|
-
};
|
|
155
|
-
request?: OperationSchema;
|
|
156
|
-
response: OperationSchema;
|
|
157
|
-
responses: Array<OperationSchema>;
|
|
158
|
-
statusCodes?: Array<OperationSchema>;
|
|
159
|
-
errors?: Array<OperationSchema>;
|
|
160
|
-
};
|
|
161
|
-
type ByTag = {
|
|
162
|
-
type: 'tag';
|
|
163
|
-
pattern: string | RegExp;
|
|
164
|
-
};
|
|
165
|
-
type ByOperationId = {
|
|
166
|
-
type: 'operationId';
|
|
167
|
-
pattern: string | RegExp;
|
|
168
|
-
};
|
|
169
|
-
type ByPath = {
|
|
170
|
-
type: 'path';
|
|
171
|
-
pattern: string | RegExp;
|
|
172
|
-
};
|
|
173
|
-
type ByMethod = {
|
|
174
|
-
type: 'method';
|
|
175
|
-
pattern: HttpMethod | RegExp;
|
|
176
|
-
};
|
|
177
|
-
type BySchemaName = {
|
|
178
|
-
type: 'schemaName';
|
|
179
|
-
pattern: string | RegExp;
|
|
180
|
-
};
|
|
181
|
-
type ByContentType = {
|
|
182
|
-
type: 'contentType';
|
|
183
|
-
pattern: string | RegExp;
|
|
184
|
-
};
|
|
185
|
-
type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
186
|
-
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
187
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
188
|
-
options: Partial<TOptions>;
|
|
189
|
-
};
|
|
190
|
-
type ResolvedOptions = Options & {
|
|
191
|
-
output: Output<Oas>;
|
|
192
|
-
};
|
|
193
|
-
type PluginOas = PluginFactoryOptions<'plugin-oas', Options, ResolvedOptions, Context$2, ResolvePathOptions>;
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region src/OperationGenerator.d.ts
|
|
196
|
-
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
197
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
198
|
-
fabric: Fabric;
|
|
199
|
-
oas: Oas;
|
|
200
|
-
exclude: Array<Exclude> | undefined;
|
|
201
|
-
include: Array<Include> | undefined;
|
|
202
|
-
override: Array<Override<TOptions>> | undefined;
|
|
203
|
-
contentType: contentType | undefined;
|
|
204
|
-
pluginManager: PluginManager;
|
|
205
|
-
events?: AsyncEventEmitter<KubbEvents>;
|
|
206
|
-
/**
|
|
207
|
-
* Current plugin
|
|
208
|
-
*/
|
|
209
|
-
plugin: Plugin<TPluginOptions>;
|
|
210
|
-
mode: KubbFile.Mode;
|
|
211
|
-
UNSTABLE_NAMING?: true;
|
|
212
|
-
};
|
|
213
|
-
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
214
|
-
#private;
|
|
215
|
-
getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
|
|
216
|
-
getSchemas(operation: Operation, {
|
|
217
|
-
resolveName
|
|
218
|
-
}?: {
|
|
219
|
-
resolveName?: (name: string) => string;
|
|
220
|
-
}): OperationSchemas;
|
|
221
|
-
getOperations(): Promise<Array<{
|
|
222
|
-
path: string;
|
|
223
|
-
method: HttpMethod;
|
|
224
|
-
operation: Operation;
|
|
225
|
-
}>>;
|
|
226
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
227
|
-
}
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/SchemaGenerator.d.ts
|
|
230
|
-
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
231
|
-
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
232
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
233
|
-
fabric: Fabric;
|
|
234
|
-
oas: Oas;
|
|
235
|
-
pluginManager: PluginManager;
|
|
236
|
-
events?: AsyncEventEmitter<KubbEvents>;
|
|
237
|
-
/**
|
|
238
|
-
* Current plugin
|
|
239
|
-
*/
|
|
240
|
-
plugin: Plugin<TPluginOptions>;
|
|
241
|
-
mode: KubbFile.Mode;
|
|
242
|
-
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
243
|
-
override: Array<Override<TOptions>> | undefined;
|
|
244
|
-
contentType?: contentType;
|
|
245
|
-
output?: string;
|
|
246
|
-
};
|
|
247
|
-
type SchemaGeneratorOptions = {
|
|
248
|
-
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
249
|
-
integerType?: 'number' | 'bigint';
|
|
250
|
-
unknownType: 'any' | 'unknown' | 'void';
|
|
251
|
-
emptySchemaType: 'any' | 'unknown' | 'void';
|
|
252
|
-
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
|
|
253
|
-
enumSuffix?: string;
|
|
254
|
-
/**
|
|
255
|
-
* @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
|
|
256
|
-
* When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
|
|
257
|
-
* @internal
|
|
258
|
-
*/
|
|
259
|
-
usedEnumNames?: Record<string, number>;
|
|
260
|
-
mapper?: Record<string, string>;
|
|
261
|
-
typed?: boolean;
|
|
262
|
-
transformers: {
|
|
263
|
-
/**
|
|
264
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
265
|
-
*/
|
|
266
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
267
|
-
/**
|
|
268
|
-
* Receive schema and name(propertyName) and return FakerMeta array
|
|
269
|
-
* TODO TODO add docs
|
|
270
|
-
* @beta
|
|
271
|
-
*/
|
|
272
|
-
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
|
|
273
|
-
};
|
|
274
|
-
};
|
|
275
|
-
type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
|
|
276
|
-
type SchemaProps$1 = {
|
|
277
|
-
schema: SchemaObject | null;
|
|
278
|
-
name: string | null;
|
|
279
|
-
parentName: string | null;
|
|
280
|
-
rootName?: string | null;
|
|
281
|
-
};
|
|
282
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
283
|
-
#private;
|
|
284
|
-
refs: Refs;
|
|
285
|
-
/**
|
|
286
|
-
* Creates a type node from a given schema.
|
|
287
|
-
* Delegates to getBaseTypeFromSchema internally and
|
|
288
|
-
* optionally adds a union with null.
|
|
289
|
-
*/
|
|
290
|
-
parse(props: SchemaProps$1): Schema[];
|
|
291
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
292
|
-
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
293
|
-
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
294
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
295
|
-
}
|
|
296
|
-
//#endregion
|
|
297
|
-
//#region src/generators/createReactGenerator.d.ts
|
|
298
|
-
type UserGenerator$1<TOptions extends PluginFactoryOptions> = {
|
|
299
|
-
name: string;
|
|
300
|
-
Operations?: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
301
|
-
Operation?: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
302
|
-
Schema?: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
303
|
-
};
|
|
304
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
305
|
-
name: string;
|
|
306
|
-
type: 'react';
|
|
307
|
-
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
308
|
-
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
309
|
-
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
310
|
-
};
|
|
311
|
-
/****
|
|
312
|
-
* Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
|
|
313
|
-
*
|
|
314
|
-
* The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.
|
|
315
|
-
*
|
|
316
|
-
* @returns A generator object with async methods for operations, operation, and schema file generation.
|
|
317
|
-
*/
|
|
318
|
-
declare function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): ReactGenerator<TOptions>;
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region src/generators/types.d.ts
|
|
321
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
322
|
-
config: Config;
|
|
323
|
-
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
324
|
-
plugin: Plugin<TOptions>;
|
|
325
|
-
operations: Array<Operation>;
|
|
326
|
-
};
|
|
327
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
328
|
-
config: Config;
|
|
329
|
-
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
330
|
-
plugin: Plugin<TOptions>;
|
|
331
|
-
operation: Operation;
|
|
332
|
-
};
|
|
333
|
-
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
334
|
-
config: Config;
|
|
335
|
-
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
336
|
-
plugin: Plugin<TOptions>;
|
|
337
|
-
schema: {
|
|
338
|
-
name: string;
|
|
339
|
-
tree: Array<Schema>;
|
|
340
|
-
value: SchemaObject;
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
344
|
-
//#endregion
|
|
345
|
-
//#region src/generators/createGenerator.d.ts
|
|
346
|
-
type UserGenerator<TOptions extends PluginFactoryOptions> = {
|
|
347
|
-
name: string;
|
|
348
|
-
operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
349
|
-
operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
350
|
-
schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
351
|
-
};
|
|
352
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
353
|
-
name: string;
|
|
354
|
-
type: 'core';
|
|
355
|
-
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
356
|
-
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
357
|
-
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
358
|
-
};
|
|
359
|
-
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
|
|
360
|
-
//#endregion
|
|
361
|
-
export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, Refs as x, PluginOas as y };
|
|
362
|
-
//# sourceMappingURL=createGenerator-Dh3WEfpI.d.ts.map
|