@cerios/openapi-to-zod 1.3.2 → 1.5.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/LICENSE +8 -0
- package/README.md +546 -395
- package/dist/cli.js +831 -1321
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +864 -1371
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +472 -59
- package/dist/index.d.ts +472 -59
- package/dist/index.js +669 -909
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +675 -884
- package/dist/index.mjs.map +1 -1
- package/package.json +89 -104
- package/dist/internal.d.mts +0 -363
- package/dist/internal.d.ts +0 -363
- package/dist/internal.js +0 -759
- package/dist/internal.js.map +0 -1
- package/dist/internal.mjs +0 -706
- package/dist/internal.mjs.map +0 -1
- package/dist/types-DZ4Bw-D5.d.mts +0 -505
- package/dist/types-DZ4Bw-D5.d.ts +0 -505
package/dist/types-DZ4Bw-D5.d.ts
DELETED
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common options shared by both request and response contexts
|
|
3
|
-
*/
|
|
4
|
-
interface CommonSchemaOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Object validation mode
|
|
7
|
-
* - 'strict': Uses z.strictObject() - no additional properties allowed
|
|
8
|
-
* - 'normal': Uses z.object() - additional properties allowed
|
|
9
|
-
* - 'loose': Uses z.looseObject() - explicitly allows additional properties
|
|
10
|
-
*/
|
|
11
|
-
mode?: "strict" | "normal" | "loose";
|
|
12
|
-
/**
|
|
13
|
-
* Whether to add .describe() calls for better error messages
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
useDescribe?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Whether to include descriptions as JSDoc comments
|
|
19
|
-
*/
|
|
20
|
-
includeDescriptions?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Default nullable behavior when not explicitly specified in the schema
|
|
23
|
-
*
|
|
24
|
-
* When true: Properties without explicit nullable annotation are treated as nullable.
|
|
25
|
-
* This follows the industry de facto standard for OpenAPI 3.0.x where tooling convergence
|
|
26
|
-
* made "nullable by default" the safest assumption.
|
|
27
|
-
*
|
|
28
|
-
* When false (default): Properties are only nullable when explicitly marked with `nullable: true`
|
|
29
|
-
* (OpenAPI 3.0) or `type: ["string", "null"]` (OpenAPI 3.1).
|
|
30
|
-
*
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
defaultNullable?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Behavior for empty object schemas (objects with no properties defined)
|
|
36
|
-
*
|
|
37
|
-
* - 'strict': Uses z.strictObject({}) - no additional properties allowed
|
|
38
|
-
* - 'loose': Uses z.looseObject({}) - explicitly allows additional properties (Zod v4)
|
|
39
|
-
* - 'record': Uses z.record(z.string(), z.unknown()) - treat as arbitrary key-value map
|
|
40
|
-
*
|
|
41
|
-
* Note: This option controls nested/property-level empty objects.
|
|
42
|
-
* The top-level `mode` option controls how schema definitions are wrapped.
|
|
43
|
-
*
|
|
44
|
-
* @default 'loose'
|
|
45
|
-
*/
|
|
46
|
-
emptyObjectBehavior?: "strict" | "loose" | "record";
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Request-specific options that can override root-level options
|
|
50
|
-
*/
|
|
51
|
-
interface RequestOptions extends CommonSchemaOptions {
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Response-specific options that can override root-level options
|
|
55
|
-
*/
|
|
56
|
-
interface ResponseOptions extends CommonSchemaOptions {
|
|
57
|
-
}
|
|
58
|
-
interface OpenApiGeneratorOptions {
|
|
59
|
-
/**
|
|
60
|
-
* Object validation mode
|
|
61
|
-
* - 'strict': Uses z.strictObject() - no additional properties allowed
|
|
62
|
-
* - 'normal': Uses z.object() - additional properties allowed
|
|
63
|
-
* - 'loose': Uses z.looseObject() - explicitly allows additional properties
|
|
64
|
-
*/
|
|
65
|
-
mode?: "strict" | "normal" | "loose";
|
|
66
|
-
/**
|
|
67
|
-
* Input OpenAPI YAML file path
|
|
68
|
-
*/
|
|
69
|
-
input: string;
|
|
70
|
-
/**
|
|
71
|
-
* Output TypeScript file path
|
|
72
|
-
*/
|
|
73
|
-
output: string;
|
|
74
|
-
/**
|
|
75
|
-
* Whether to include descriptions as JSDoc comments
|
|
76
|
-
*/
|
|
77
|
-
includeDescriptions?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Whether to add .describe() calls for better error messages
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
useDescribe?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Default nullable behavior when not explicitly specified in the schema
|
|
85
|
-
*
|
|
86
|
-
* When true: Properties without explicit nullable annotation are treated as nullable.
|
|
87
|
-
* This follows the industry de facto standard for OpenAPI 3.0.x where tooling convergence
|
|
88
|
-
* made "nullable by default" the safest assumption.
|
|
89
|
-
*
|
|
90
|
-
* When false (default): Properties are only nullable when explicitly marked with `nullable: true`
|
|
91
|
-
* (OpenAPI 3.0) or `type: ["string", "null"]` (OpenAPI 3.1).
|
|
92
|
-
*
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
defaultNullable?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Behavior for empty object schemas (objects with no properties defined)
|
|
98
|
-
*
|
|
99
|
-
* - 'strict': Uses z.strictObject({}) - no additional properties allowed
|
|
100
|
-
* - 'loose': Uses z.looseObject({}) - explicitly allows additional properties (Zod v4)
|
|
101
|
-
* - 'record': Uses z.record(z.string(), z.unknown()) - treat as arbitrary key-value map
|
|
102
|
-
*
|
|
103
|
-
* Note: This option controls nested/property-level empty objects.
|
|
104
|
-
* The top-level `mode` option controls how schema definitions are wrapped.
|
|
105
|
-
*
|
|
106
|
-
* @default 'loose'
|
|
107
|
-
*/
|
|
108
|
-
emptyObjectBehavior?: "strict" | "loose" | "record";
|
|
109
|
-
/**
|
|
110
|
-
* Schema filtering mode
|
|
111
|
-
* - 'all': Generate all schemas (default)
|
|
112
|
-
* - 'request': Only include schemas suitable for requests (excludes readOnly)
|
|
113
|
-
* - 'response': Only include schemas suitable for responses (excludes writeOnly)
|
|
114
|
-
*/
|
|
115
|
-
schemaType?: "all" | "request" | "response";
|
|
116
|
-
/**
|
|
117
|
-
* Prefix to add to all generated schema names
|
|
118
|
-
* @example "api" -> "apiUserSchema"
|
|
119
|
-
*/
|
|
120
|
-
prefix?: string;
|
|
121
|
-
/**
|
|
122
|
-
* Suffix to add before "Schema" in generated names
|
|
123
|
-
* @example "dto" -> "userDtoSchema"
|
|
124
|
-
*/
|
|
125
|
-
suffix?: string;
|
|
126
|
-
/**
|
|
127
|
-
* Strip a common prefix from all schema names before processing
|
|
128
|
-
* Useful when OpenAPI spec has redundant schema prefixes that you want to ignore
|
|
129
|
-
*
|
|
130
|
-
* Supports both literal strings and glob patterns:
|
|
131
|
-
* - Literal string: "Company.Models." (must match exactly)
|
|
132
|
-
* - Glob pattern: "*.Models." (uses minimatch for pattern matching)
|
|
133
|
-
*
|
|
134
|
-
* Glob pattern syntax:
|
|
135
|
-
* - * matches any characters within a single segment (stops at .)
|
|
136
|
-
* - ** matches any characters across multiple segments (crosses . boundaries)
|
|
137
|
-
* - ? matches a single character
|
|
138
|
-
* - [abc] matches any character in the set
|
|
139
|
-
* - {a,b} matches any of the alternatives
|
|
140
|
-
* - !(pattern) matches anything except the pattern
|
|
141
|
-
*
|
|
142
|
-
* This affects:
|
|
143
|
-
* - Schema name generation (shorter, cleaner names)
|
|
144
|
-
* - Type name generation
|
|
145
|
-
* - References to schemas
|
|
146
|
-
*
|
|
147
|
-
* Applied before prefix/suffix options.
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* // Spec has: "Company.Models.User", "Company.Models.Post"
|
|
151
|
-
* // stripSchemaPrefix: "Company.Models."
|
|
152
|
-
* // Results in: "User", "Post"
|
|
153
|
-
* // Schema names: userSchema, postSchema
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* // Strip any namespace prefix using glob pattern
|
|
157
|
-
* // stripSchemaPrefix: "*.Models."
|
|
158
|
-
* // Matches: "Company.Models.User", "App.Models.User", etc.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* // Strip versioned prefix
|
|
162
|
-
* // stripSchemaPrefix: "api_v[0-9]_"
|
|
163
|
-
* // Matches: "api_v1_User", "api_v2_Post", etc.
|
|
164
|
-
*
|
|
165
|
-
* @default undefined (no stripping)
|
|
166
|
-
*/
|
|
167
|
-
stripSchemaPrefix?: string;
|
|
168
|
-
/**
|
|
169
|
-
* Whether to include generation statistics in output file
|
|
170
|
-
* @default true
|
|
171
|
-
*/
|
|
172
|
-
showStats?: boolean;
|
|
173
|
-
/**
|
|
174
|
-
* Fallback parsing method for unknown or missing content types
|
|
175
|
-
*
|
|
176
|
-
* When a content type is not recognized, this determines how the response is parsed:
|
|
177
|
-
* - "text": Use response.text() - safest, always succeeds (default)
|
|
178
|
-
* - "json": Use response.json() - may throw if response isn't valid JSON
|
|
179
|
-
* - "body": Use response.body() - returns raw Buffer
|
|
180
|
-
*
|
|
181
|
-
* A warning will be logged during generation when an unknown content type is encountered.
|
|
182
|
-
*
|
|
183
|
-
* @default "text"
|
|
184
|
-
*/
|
|
185
|
-
fallbackContentTypeParsing?: "text" | "json" | "body";
|
|
186
|
-
/**
|
|
187
|
-
* Request-specific options that override root-level options
|
|
188
|
-
* Applied when schemas are used in request contexts
|
|
189
|
-
*/
|
|
190
|
-
request?: RequestOptions;
|
|
191
|
-
/**
|
|
192
|
-
* Response-specific options that override root-level options
|
|
193
|
-
* Applied when schemas are used in response contexts
|
|
194
|
-
*/
|
|
195
|
-
response?: ResponseOptions;
|
|
196
|
-
/**
|
|
197
|
-
* Filter which operations to include/exclude from generation
|
|
198
|
-
* Useful for generating separate schemas for different API subsets
|
|
199
|
-
*
|
|
200
|
-
* Filtering logic:
|
|
201
|
-
* 1. If no filters specified, all operations are included
|
|
202
|
-
* 2. Empty arrays are treated as "no constraint" (not as "exclude all")
|
|
203
|
-
* 3. Include filters are applied first (allowlist)
|
|
204
|
-
* 4. Exclude filters are applied second (blocklist)
|
|
205
|
-
* 5. Exclude rules always win over include rules
|
|
206
|
-
*
|
|
207
|
-
* Supports glob patterns for paths and operationIds (e.g., "/api/v1/**", "get*")
|
|
208
|
-
*
|
|
209
|
-
* @example
|
|
210
|
-
* // Only generate schemas for user-related endpoints
|
|
211
|
-
* operationFilters: {
|
|
212
|
-
* includeTags: ["users"]
|
|
213
|
-
* }
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* // Generate only GET endpoints, excluding deprecated ones
|
|
217
|
-
* operationFilters: {
|
|
218
|
-
* includeMethods: ["get"],
|
|
219
|
-
* excludeDeprecated: true
|
|
220
|
-
* }
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* // Generate only v1 API endpoints
|
|
224
|
-
* operationFilters: {
|
|
225
|
-
* includePaths: ["/api/v1/**"]
|
|
226
|
-
* }
|
|
227
|
-
*/
|
|
228
|
-
operationFilters?: OperationFilters;
|
|
229
|
-
/**
|
|
230
|
-
* Header parameters to ignore during schema generation
|
|
231
|
-
* Supports glob patterns for flexible matching
|
|
232
|
-
* Case-insensitive matching (HTTP header semantics)
|
|
233
|
-
*
|
|
234
|
-
* @internal Used by Playwright generator
|
|
235
|
-
*/
|
|
236
|
-
ignoreHeaders?: string[];
|
|
237
|
-
/**
|
|
238
|
-
* Strip a common prefix from all paths before generating query/header parameter schema names
|
|
239
|
-
* This is used when operationId is not available and schema names are derived from the path.
|
|
240
|
-
*
|
|
241
|
-
* Supports both literal strings and glob patterns:
|
|
242
|
-
* - Literal string: "/api/v1" (must match exactly)
|
|
243
|
-
* - Glob pattern: "/api/v*" (uses minimatch for pattern matching)
|
|
244
|
-
*
|
|
245
|
-
* @example
|
|
246
|
-
* // Path: "/api/v1/users" with stripPathPrefix: "/api/v1"
|
|
247
|
-
* // Results in: GetUsersQueryParams (not GetApiV1UsersQueryParams)
|
|
248
|
-
*
|
|
249
|
-
* @internal Used by Playwright generator
|
|
250
|
-
* @default undefined (no stripping)
|
|
251
|
-
*/
|
|
252
|
-
stripPathPrefix?: string;
|
|
253
|
-
/**
|
|
254
|
-
* Cache size for pattern regex compilation
|
|
255
|
-
* Higher values improve performance for large specifications with many string patterns
|
|
256
|
-
* @default 1000
|
|
257
|
-
*/
|
|
258
|
-
cacheSize?: number;
|
|
259
|
-
/**
|
|
260
|
-
* Batch size for parallel execution
|
|
261
|
-
* Controls how many specifications are processed concurrently in parallel mode
|
|
262
|
-
* Higher values increase memory usage but may improve throughput
|
|
263
|
-
* @default 10
|
|
264
|
-
*/
|
|
265
|
-
batchSize?: number;
|
|
266
|
-
/**
|
|
267
|
-
* Custom regex pattern for date-time format validation
|
|
268
|
-
* Overrides the default z.iso.datetime() which requires ISO 8601 format with timezone suffix (Z)
|
|
269
|
-
*
|
|
270
|
-
* **Config File Formats:**
|
|
271
|
-
* - JSON/YAML configs: Must use string pattern (requires double-escaping: `\\d`)
|
|
272
|
-
* - TypeScript configs: Can use either string pattern OR RegExp literal (`/\d/`)
|
|
273
|
-
*
|
|
274
|
-
* **Common Patterns:**
|
|
275
|
-
* ```typescript
|
|
276
|
-
* // No timezone suffix (e.g., "2026-01-07T14:30:00")
|
|
277
|
-
* customDateTimeFormatRegex: '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$'
|
|
278
|
-
* // OR in TypeScript config:
|
|
279
|
-
* customDateTimeFormatRegex: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/
|
|
280
|
-
*
|
|
281
|
-
* // With milliseconds, no Z (e.g., "2026-01-07T14:30:00.123")
|
|
282
|
-
* customDateTimeFormatRegex: '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}$'
|
|
283
|
-
*
|
|
284
|
-
* // Optional Z suffix (e.g., "2026-01-07T14:30:00" or "2026-01-07T14:30:00Z")
|
|
285
|
-
* customDateTimeFormatRegex: '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z?$'
|
|
286
|
-
* ```
|
|
287
|
-
*
|
|
288
|
-
* @default "z.iso.datetime()" (requires Z suffix per ISO 8601)
|
|
289
|
-
*/
|
|
290
|
-
customDateTimeFormatRegex?: string | RegExp;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Operation filtering options
|
|
294
|
-
* Controls which operations from the OpenAPI specification are included in generation
|
|
295
|
-
*/
|
|
296
|
-
interface OperationFilters {
|
|
297
|
-
/**
|
|
298
|
-
* Include only operations with these tags
|
|
299
|
-
* If specified, only operations with at least one matching tag are included
|
|
300
|
-
* Empty array = no constraint
|
|
301
|
-
*/
|
|
302
|
-
includeTags?: string[];
|
|
303
|
-
/**
|
|
304
|
-
* Exclude operations with these tags
|
|
305
|
-
* Operations with any matching tag are excluded
|
|
306
|
-
* Empty array = no constraint
|
|
307
|
-
*/
|
|
308
|
-
excludeTags?: string[];
|
|
309
|
-
/**
|
|
310
|
-
* Include only operations matching these path patterns
|
|
311
|
-
* Supports glob patterns (e.g., "/users/**", "/api/v1/*")
|
|
312
|
-
* Empty array = no constraint
|
|
313
|
-
*/
|
|
314
|
-
includePaths?: string[];
|
|
315
|
-
/**
|
|
316
|
-
* Exclude operations matching these path patterns
|
|
317
|
-
* Supports glob patterns (e.g., "/internal/**", "/admin/*")
|
|
318
|
-
* Empty array = no constraint
|
|
319
|
-
*/
|
|
320
|
-
excludePaths?: string[];
|
|
321
|
-
/**
|
|
322
|
-
* Include only these HTTP methods
|
|
323
|
-
* Valid values: "get", "post", "put", "patch", "delete", "head", "options"
|
|
324
|
-
* Empty array = no constraint
|
|
325
|
-
*/
|
|
326
|
-
includeMethods?: string[];
|
|
327
|
-
/**
|
|
328
|
-
* Exclude these HTTP methods
|
|
329
|
-
* Valid values: "get", "post", "put", "patch", "delete", "head", "options"
|
|
330
|
-
* Empty array = no constraint
|
|
331
|
-
*/
|
|
332
|
-
excludeMethods?: string[];
|
|
333
|
-
/**
|
|
334
|
-
* Include only operations matching these operationId patterns
|
|
335
|
-
* Supports glob patterns (e.g., "getUser*", "*Admin")
|
|
336
|
-
* Empty array = no constraint
|
|
337
|
-
*/
|
|
338
|
-
includeOperationIds?: string[];
|
|
339
|
-
/**
|
|
340
|
-
* Exclude operations matching these operationId patterns
|
|
341
|
-
* Supports glob patterns (e.g., "deleteUser*", "*Internal")
|
|
342
|
-
* Empty array = no constraint
|
|
343
|
-
*/
|
|
344
|
-
excludeOperationIds?: string[];
|
|
345
|
-
/**
|
|
346
|
-
* Whether to exclude deprecated operations
|
|
347
|
-
* @default false
|
|
348
|
-
*/
|
|
349
|
-
excludeDeprecated?: boolean;
|
|
350
|
-
}
|
|
351
|
-
interface OpenAPISchema {
|
|
352
|
-
type?: string | string[];
|
|
353
|
-
format?: string;
|
|
354
|
-
enum?: (string | number | boolean)[];
|
|
355
|
-
const?: string | number | boolean | null;
|
|
356
|
-
properties?: Record<string, OpenAPISchema>;
|
|
357
|
-
required?: string[];
|
|
358
|
-
items?: OpenAPISchema;
|
|
359
|
-
prefixItems?: OpenAPISchema[];
|
|
360
|
-
allOf?: OpenAPISchema[];
|
|
361
|
-
oneOf?: OpenAPISchema[];
|
|
362
|
-
anyOf?: OpenAPISchema[];
|
|
363
|
-
$ref?: string;
|
|
364
|
-
nullable?: boolean;
|
|
365
|
-
minLength?: number;
|
|
366
|
-
maxLength?: number;
|
|
367
|
-
minimum?: number;
|
|
368
|
-
maximum?: number;
|
|
369
|
-
exclusiveMinimum?: boolean | number;
|
|
370
|
-
exclusiveMaximum?: boolean | number;
|
|
371
|
-
multipleOf?: number;
|
|
372
|
-
pattern?: string;
|
|
373
|
-
description?: string;
|
|
374
|
-
title?: string;
|
|
375
|
-
example?: any;
|
|
376
|
-
examples?: any[];
|
|
377
|
-
additionalProperties?: boolean | OpenAPISchema;
|
|
378
|
-
minProperties?: number;
|
|
379
|
-
maxProperties?: number;
|
|
380
|
-
minItems?: number;
|
|
381
|
-
maxItems?: number;
|
|
382
|
-
uniqueItems?: boolean;
|
|
383
|
-
contains?: OpenAPISchema;
|
|
384
|
-
minContains?: number;
|
|
385
|
-
maxContains?: number;
|
|
386
|
-
discriminator?: {
|
|
387
|
-
propertyName: string;
|
|
388
|
-
mapping?: Record<string, string>;
|
|
389
|
-
};
|
|
390
|
-
readOnly?: boolean;
|
|
391
|
-
writeOnly?: boolean;
|
|
392
|
-
deprecated?: boolean;
|
|
393
|
-
dependentRequired?: Record<string, string[]>;
|
|
394
|
-
dependencies?: Record<string, string[] | OpenAPISchema>;
|
|
395
|
-
patternProperties?: Record<string, OpenAPISchema>;
|
|
396
|
-
propertyNames?: OpenAPISchema;
|
|
397
|
-
contentMediaType?: string;
|
|
398
|
-
contentEncoding?: string;
|
|
399
|
-
not?: OpenAPISchema;
|
|
400
|
-
if?: OpenAPISchema;
|
|
401
|
-
then?: OpenAPISchema;
|
|
402
|
-
else?: OpenAPISchema;
|
|
403
|
-
unevaluatedProperties?: boolean | OpenAPISchema;
|
|
404
|
-
unevaluatedItems?: boolean | OpenAPISchema;
|
|
405
|
-
}
|
|
406
|
-
interface OpenAPISpec {
|
|
407
|
-
components?: {
|
|
408
|
-
schemas?: Record<string, OpenAPISchema>;
|
|
409
|
-
parameters?: Record<string, OpenAPIParameter>;
|
|
410
|
-
requestBodies?: Record<string, OpenAPIRequestBody>;
|
|
411
|
-
responses?: Record<string, OpenAPIResponse>;
|
|
412
|
-
};
|
|
413
|
-
paths?: Record<string, any>;
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* OpenAPI parameter definition for component parameters
|
|
417
|
-
*/
|
|
418
|
-
interface OpenAPIParameter {
|
|
419
|
-
name: string;
|
|
420
|
-
in: "query" | "header" | "path" | "cookie";
|
|
421
|
-
description?: string;
|
|
422
|
-
required?: boolean;
|
|
423
|
-
schema?: OpenAPISchema;
|
|
424
|
-
deprecated?: boolean;
|
|
425
|
-
allowEmptyValue?: boolean;
|
|
426
|
-
style?: string;
|
|
427
|
-
explode?: boolean;
|
|
428
|
-
allowReserved?: boolean;
|
|
429
|
-
example?: any;
|
|
430
|
-
examples?: Record<string, any>;
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* OpenAPI request body definition for component request bodies
|
|
434
|
-
*/
|
|
435
|
-
interface OpenAPIRequestBody {
|
|
436
|
-
description?: string;
|
|
437
|
-
content?: Record<string, {
|
|
438
|
-
schema?: OpenAPISchema;
|
|
439
|
-
}>;
|
|
440
|
-
required?: boolean;
|
|
441
|
-
$ref?: string;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* OpenAPI response definition for component responses
|
|
445
|
-
*/
|
|
446
|
-
interface OpenAPIResponse {
|
|
447
|
-
description?: string;
|
|
448
|
-
content?: Record<string, {
|
|
449
|
-
schema?: OpenAPISchema;
|
|
450
|
-
}>;
|
|
451
|
-
headers?: Record<string, {
|
|
452
|
-
schema?: OpenAPISchema;
|
|
453
|
-
description?: string;
|
|
454
|
-
}>;
|
|
455
|
-
$ref?: string;
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Execution mode for batch processing
|
|
459
|
-
* - 'parallel': Process all specifications concurrently (default, faster)
|
|
460
|
-
* - 'sequential': Process specifications one at a time (safer for resource constraints)
|
|
461
|
-
*/
|
|
462
|
-
type ExecutionMode = "parallel" | "sequential";
|
|
463
|
-
/**
|
|
464
|
-
* Root configuration file structure
|
|
465
|
-
*/
|
|
466
|
-
interface ConfigFile {
|
|
467
|
-
/**
|
|
468
|
-
* Global default options applied to all specifications
|
|
469
|
-
* Can be overridden by individual specification configurations
|
|
470
|
-
*/
|
|
471
|
-
defaults?: Partial<Omit<OpenApiGeneratorOptions, "input" | "output">>;
|
|
472
|
-
/**
|
|
473
|
-
* Array of OpenAPI specifications to process
|
|
474
|
-
* Each specification must have input and output paths
|
|
475
|
-
*/
|
|
476
|
-
specs: OpenApiGeneratorOptions[];
|
|
477
|
-
/**
|
|
478
|
-
* Execution mode for batch processing
|
|
479
|
-
* @default "parallel"
|
|
480
|
-
*/
|
|
481
|
-
executionMode?: ExecutionMode;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Helper function for type-safe config file creation
|
|
485
|
-
* Provides IDE autocomplete and type checking for config files
|
|
486
|
-
*
|
|
487
|
-
* @example
|
|
488
|
-
* ```typescript
|
|
489
|
-
* import { defineConfig } from '@cerios/openapi-to-zod';
|
|
490
|
-
*
|
|
491
|
-
* export default defineConfig({
|
|
492
|
-
* defaults: {
|
|
493
|
-
* mode: 'strict',
|
|
494
|
-
* includeDescriptions: true
|
|
495
|
-
* },
|
|
496
|
-
* specs: [
|
|
497
|
-
* { input: 'api-v1.yaml', output: 'schemas/v1.ts' },
|
|
498
|
-
* { input: 'api-v2.yaml', output: 'schemas/v2.ts', mode: 'normal' }
|
|
499
|
-
* ]
|
|
500
|
-
* });
|
|
501
|
-
* ```
|
|
502
|
-
*/
|
|
503
|
-
declare function defineConfig(config: ConfigFile): ConfigFile;
|
|
504
|
-
|
|
505
|
-
export { type CommonSchemaOptions as C, type ExecutionMode as E, type OpenApiGeneratorOptions as O, type RequestOptions as R, type ConfigFile as a, type OpenAPIParameter as b, type OpenAPIRequestBody as c, type OpenAPIResponse as d, type OpenAPISchema as e, type OpenAPISpec as f, type OperationFilters as g, type ResponseOptions as h, defineConfig as i };
|