nestjs-openapi 0.1.3 → 0.2.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/cli.mjs +84 -22
- package/dist/index.d.mts +157 -721
- package/dist/index.d.ts +157 -721
- package/dist/index.mjs +31 -85
- package/dist/internal.d.mts +2 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.mjs +52 -45
- package/dist/shared/nestjs-openapi.D0Osp4GW.d.mts +2275 -0
- package/dist/shared/nestjs-openapi.D0Osp4GW.d.ts +2275 -0
- package/dist/shared/nestjs-openapi.P9V98nna.mjs +5504 -0
- package/package.json +5 -1
- package/dist/shared/nestjs-openapi.D2c4bMP5.mjs +0 -2162
- package/dist/shared/nestjs-openapi.DRcy130f.mjs +0 -1571
- package/dist/shared/nestjs-openapi.t3iwzrrT.d.mts +0 -436
- package/dist/shared/nestjs-openapi.t3iwzrrT.d.ts +0 -436
package/dist/index.d.mts
CHANGED
|
@@ -1,679 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { A as AnalysisError, i as ConfigLoadError, j as ConfigValidationError, G as GenerateOptions, k as GeneratorError, H as HttpMethod, I as InvalidMethodError, e as ParameterLocation, f as ResolvedParameter, h as ReturnTypeInfo, d as generateAsync, g as generateEffect } from './shared/nestjs-openapi.t3iwzrrT.mjs';
|
|
1
|
+
import { O as OpenApiSpec, S as SpecFileNotFoundError, a as SpecFileReadError, b as SpecFileParseError, M as MethodInfo, c as OpenApiPaths, d as OpenApiOperation, e as OpenApiPaths$1, G as GeneratedSchemas, f as OpenApiSchema, V as ValidationService, C as ConfigService, g as ModuleTraversalService, h as MethodExtractionService, i as SchemaService, j as OutputService, P as ProjectService } from './shared/nestjs-openapi.D0Osp4GW.mjs';
|
|
2
|
+
export { a4 as AnalysisError, aJ as BrokenRef, aK as BrokenRefCategories, az as ClassValidationInfo, n as Config, a3 as ConfigError, X as ConfigLoadError, W as ConfigNotFoundError, Y as ConfigValidationError, o as ContactConfig, Z as DtoGlobResolutionError, U as EntryNotFoundError, E as GenerateOptions, s as GenerateOverrides, l as GenerateResult, a5 as GeneratorError, J as HttpMethod, I as InfoConfig, _ as InvalidMethodError, am as JsonSchema, L as LicenseConfig, $ as MissingGenericSchemaTempFileCleanupError, a0 as MissingGenericSchemaTempFileWriteError, ac as ModuleWithControllers, K as OpenApiGeneratorConfig, t as OpenApiOperation, u as OpenApiParameter, v as OpenApiRequestBody, w as OpenApiResponse, q as OutputFormat, F as ParameterLocation, a8 as ProjectContext, a2 as ProjectError, Q as ProjectInitError, a9 as ProjectOptions, a6 as ProjectServiceLive, ay as PropertyValidationInfo, a1 as PublicApiError, N as ResolvedConfig, R as ResolvedParameter, H as ReturnTypeInfo, ak as SchemaError, aj as SchemaGenerationError, al as SchemaGeneratorOptions, p as ServerConfig, T as TagConfig, r as TelemetryConfig, ax as ValidationConstraints, aI as ValidationResult, au as applyConstraintsToSchema, aG as categorizeBrokenRefs, m as defineConfig, as as extractClassConstraints, aq as extractClassValidationInfo, ar as extractClassValidationInfoEffect, an as extractPropertyConstraints, ap as extractPropertyValidationInfo, aA as findConfigFile, aH as formatValidationResult, k as generate, y as generateAsync, x as generateEffect, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect, ah as generateSchemas, ai as generateSchemasFromFiles, ab as getAllControllers, af as getControllerMethodInfos, ag as getControllerMethodInfosEffect, ad as getMethodInfo, ae as getMethodInfoEffect, aa as getModules, at as getRequiredProperties, ao as isPropertyOptional, aE as loadAndResolveConfig, aC as loadConfig, aB as loadConfigFromFile, a7 as makeProjectContext, av as mergeValidationConstraints, aw as mergeValidationConstraintsEffect, aD as resolveConfig, aF as validateSpec } from './shared/nestjs-openapi.D0Osp4GW.mjs';
|
|
4
3
|
import { DynamicModule } from '@nestjs/common';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Public types for nestjs-openapi
|
|
9
|
-
*
|
|
10
|
-
* These types are exposed to consumers of the library. Internal types
|
|
11
|
-
* should be kept in domain.ts.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Contact information for the API
|
|
15
|
-
*/
|
|
16
|
-
interface ContactConfig {
|
|
17
|
-
readonly name?: string;
|
|
18
|
-
readonly email?: string;
|
|
19
|
-
readonly url?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* License information for the API
|
|
23
|
-
*/
|
|
24
|
-
interface LicenseConfig {
|
|
25
|
-
readonly name: string;
|
|
26
|
-
readonly url?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* API metadata for the OpenAPI info section
|
|
30
|
-
*/
|
|
31
|
-
interface InfoConfig {
|
|
32
|
-
readonly title: string;
|
|
33
|
-
readonly version: string;
|
|
34
|
-
readonly description?: string;
|
|
35
|
-
readonly contact?: ContactConfig;
|
|
36
|
-
readonly license?: LicenseConfig;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Server configuration for the OpenAPI servers section
|
|
40
|
-
*/
|
|
41
|
-
interface ServerConfig {
|
|
42
|
-
readonly url: string;
|
|
43
|
-
readonly description?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Tag configuration for organizing API endpoints
|
|
47
|
-
*/
|
|
48
|
-
interface TagConfig {
|
|
49
|
-
readonly name: string;
|
|
50
|
-
readonly description?: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Security scheme type for OpenAPI 3.0
|
|
54
|
-
*/
|
|
55
|
-
type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
56
|
-
/**
|
|
57
|
-
* Location for apiKey security schemes
|
|
58
|
-
*/
|
|
59
|
-
type SecuritySchemeIn = 'query' | 'header' | 'cookie';
|
|
60
|
-
/**
|
|
61
|
-
* OAuth2 flow configuration
|
|
62
|
-
*/
|
|
63
|
-
interface OAuth2FlowConfig {
|
|
64
|
-
readonly authorizationUrl?: string;
|
|
65
|
-
readonly tokenUrl?: string;
|
|
66
|
-
readonly refreshUrl?: string;
|
|
67
|
-
readonly scopes?: Record<string, string>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* OAuth2 flows configuration
|
|
71
|
-
*/
|
|
72
|
-
interface OAuth2FlowsConfig {
|
|
73
|
-
readonly implicit?: OAuth2FlowConfig;
|
|
74
|
-
readonly password?: OAuth2FlowConfig;
|
|
75
|
-
readonly clientCredentials?: OAuth2FlowConfig;
|
|
76
|
-
readonly authorizationCode?: OAuth2FlowConfig;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Security scheme configuration for OpenAPI 3.0
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* // Bearer token (JWT)
|
|
84
|
-
* {
|
|
85
|
-
* name: 'bearerAuth',
|
|
86
|
-
* type: 'http',
|
|
87
|
-
* scheme: 'bearer',
|
|
88
|
-
* bearerFormat: 'JWT',
|
|
89
|
-
* }
|
|
90
|
-
*
|
|
91
|
-
* // API Key in header
|
|
92
|
-
* {
|
|
93
|
-
* name: 'apiKey',
|
|
94
|
-
* type: 'apiKey',
|
|
95
|
-
* in: 'header',
|
|
96
|
-
* parameterName: 'X-API-Key',
|
|
97
|
-
* }
|
|
98
|
-
*
|
|
99
|
-
* // OAuth2
|
|
100
|
-
* {
|
|
101
|
-
* name: 'oauth2',
|
|
102
|
-
* type: 'oauth2',
|
|
103
|
-
* flows: {
|
|
104
|
-
* authorizationCode: {
|
|
105
|
-
* authorizationUrl: 'https://example.com/oauth/authorize',
|
|
106
|
-
* tokenUrl: 'https://example.com/oauth/token',
|
|
107
|
-
* scopes: { 'read:users': 'Read user data' },
|
|
108
|
-
* },
|
|
109
|
-
* },
|
|
110
|
-
* }
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
interface SecuritySchemeConfig {
|
|
114
|
-
/** Unique name for this security scheme (used as key in securitySchemes) */
|
|
115
|
-
readonly name: string;
|
|
116
|
-
/** The type of the security scheme */
|
|
117
|
-
readonly type: SecuritySchemeType;
|
|
118
|
-
/** Description of the security scheme */
|
|
119
|
-
readonly description?: string;
|
|
120
|
-
/** The name of the HTTP Authorization scheme (for type: 'http') */
|
|
121
|
-
readonly scheme?: string;
|
|
122
|
-
/** A hint for the format of the token (for type: 'http' with scheme: 'bearer') */
|
|
123
|
-
readonly bearerFormat?: string;
|
|
124
|
-
/** The location of the API key (for type: 'apiKey') */
|
|
125
|
-
readonly in?: SecuritySchemeIn;
|
|
126
|
-
/** The name of the header, query, or cookie parameter (for type: 'apiKey') */
|
|
127
|
-
readonly parameterName?: string;
|
|
128
|
-
/** OAuth2 flows configuration (for type: 'oauth2') */
|
|
129
|
-
readonly flows?: OAuth2FlowsConfig;
|
|
130
|
-
/** OpenID Connect URL to discover OAuth2 config (for type: 'openIdConnect') */
|
|
131
|
-
readonly openIdConnectUrl?: string;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Security requirement - maps security scheme names to required scopes
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* ```typescript
|
|
138
|
-
* // Require bearerAuth with no specific scopes
|
|
139
|
-
* { bearerAuth: [] }
|
|
140
|
-
*
|
|
141
|
-
* // Require oauth2 with specific scopes
|
|
142
|
-
* { oauth2: ['read:users', 'write:users'] }
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
type SecurityRequirement = Record<string, readonly string[]>;
|
|
146
|
-
/**
|
|
147
|
-
* Output format for the generated OpenAPI specification
|
|
148
|
-
*/
|
|
149
|
-
type OutputFormat = 'json' | 'yaml';
|
|
150
|
-
/**
|
|
151
|
-
* OpenAPI specification version
|
|
152
|
-
* - '3.0.3': OpenAPI 3.0.3 (default, widely supported)
|
|
153
|
-
* - '3.1.0': OpenAPI 3.1.0 (full JSON Schema 2020-12 alignment, type arrays for nullable)
|
|
154
|
-
* - '3.2.0': OpenAPI 3.2.0 (when released, will include webhooks and other new features)
|
|
155
|
-
*/
|
|
156
|
-
type OpenApiVersion = '3.0.3' | '3.1.0' | '3.2.0';
|
|
157
|
-
/**
|
|
158
|
-
* Input file configuration for nestjs-openapi.
|
|
159
|
-
* All paths are relative to the config file location.
|
|
160
|
-
*/
|
|
161
|
-
interface FilesConfig {
|
|
162
|
-
/**
|
|
163
|
-
* Entry module file(s).
|
|
164
|
-
* @default "src/app.module.ts"
|
|
165
|
-
*/
|
|
166
|
-
readonly entry?: string | readonly string[];
|
|
167
|
-
/**
|
|
168
|
-
* Path to tsconfig.json. Auto-detected if not specified.
|
|
169
|
-
*/
|
|
170
|
-
readonly tsconfig?: string;
|
|
171
|
-
/**
|
|
172
|
-
* Glob pattern(s) for DTO files to generate schemas from.
|
|
173
|
-
* @example "src/**\/*.dto.ts"
|
|
174
|
-
*/
|
|
175
|
-
readonly dtoGlob?: string | readonly string[];
|
|
176
|
-
/**
|
|
177
|
-
* Glob patterns to include.
|
|
178
|
-
*/
|
|
179
|
-
readonly include?: readonly string[];
|
|
180
|
-
/**
|
|
181
|
-
* Glob patterns to exclude.
|
|
182
|
-
* @default ["**\/*.spec.ts", "**\/*.test.ts", "**\/node_modules/**"]
|
|
183
|
-
*/
|
|
184
|
-
readonly exclude?: readonly string[];
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Security configuration for OpenAPI spec.
|
|
188
|
-
*/
|
|
189
|
-
interface SecurityConfig {
|
|
190
|
-
/**
|
|
191
|
-
* Security schemes available for the API.
|
|
192
|
-
* Defines authentication methods (bearer, apiKey, oauth2, etc.)
|
|
193
|
-
*/
|
|
194
|
-
readonly schemes?: readonly SecuritySchemeConfig[];
|
|
195
|
-
/**
|
|
196
|
-
* Global security requirements applied to all operations.
|
|
197
|
-
* Can be overridden at the operation level.
|
|
198
|
-
* Each object in the array represents an alternative (OR logic).
|
|
199
|
-
* Within each object, all schemes must be satisfied (AND logic).
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
* ```typescript
|
|
203
|
-
* // Require bearerAuth for all operations
|
|
204
|
-
* global: [{ bearerAuth: [] }]
|
|
205
|
-
*
|
|
206
|
-
* // Allow either bearerAuth OR apiKey
|
|
207
|
-
* global: [{ bearerAuth: [] }, { apiKey: [] }]
|
|
208
|
-
* ```
|
|
209
|
-
*/
|
|
210
|
-
readonly global?: readonly SecurityRequirement[];
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* OpenAPI specification metadata configuration.
|
|
214
|
-
* Maps directly to the OpenAPI spec structure.
|
|
215
|
-
*/
|
|
216
|
-
interface OpenApiConfig {
|
|
217
|
-
/**
|
|
218
|
-
* OpenAPI specification version.
|
|
219
|
-
* @default "3.0.3"
|
|
220
|
-
*/
|
|
221
|
-
readonly version?: OpenApiVersion;
|
|
222
|
-
/**
|
|
223
|
-
* API metadata for the info section.
|
|
224
|
-
* @required
|
|
225
|
-
*/
|
|
226
|
-
readonly info: InfoConfig;
|
|
227
|
-
/**
|
|
228
|
-
* Server URLs for the API.
|
|
229
|
-
*/
|
|
230
|
-
readonly servers?: readonly ServerConfig[];
|
|
231
|
-
/**
|
|
232
|
-
* Tags for organizing API endpoints.
|
|
233
|
-
*/
|
|
234
|
-
readonly tags?: readonly TagConfig[];
|
|
235
|
-
/**
|
|
236
|
-
* Security configuration.
|
|
237
|
-
*/
|
|
238
|
-
readonly security?: SecurityConfig;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Generation behavior options.
|
|
242
|
-
*/
|
|
243
|
-
interface OptionsConfig {
|
|
244
|
-
/**
|
|
245
|
-
* Base path prefix for all routes.
|
|
246
|
-
* Equivalent to NestJS's app.setGlobalPrefix().
|
|
247
|
-
* @example "/api/v1"
|
|
248
|
-
*/
|
|
249
|
-
readonly basePath?: string;
|
|
250
|
-
/**
|
|
251
|
-
* Extract validation constraints from class-validator decorators.
|
|
252
|
-
* @default true
|
|
253
|
-
*/
|
|
254
|
-
readonly extractValidation?: boolean;
|
|
255
|
-
/**
|
|
256
|
-
* Decorator names that exclude endpoints from the spec.
|
|
257
|
-
* @default ["ApiExcludeEndpoint", "ApiExcludeController"]
|
|
258
|
-
*/
|
|
259
|
-
readonly excludeDecorators?: readonly string[];
|
|
260
|
-
/**
|
|
261
|
-
* Filter paths by regex or predicate function.
|
|
262
|
-
* Paths matching the regex (or returning true) are INCLUDED.
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* ```typescript
|
|
266
|
-
* // Exclude internal and versioned paths
|
|
267
|
-
* pathFilter: /^(?!.*(\/internal\/|\/v[\d.]+\/)).* /
|
|
268
|
-
*
|
|
269
|
-
* // Using a function
|
|
270
|
-
* pathFilter: (path) => !path.includes('/internal/')
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
readonly pathFilter?: RegExp | ((path: string) => boolean);
|
|
274
|
-
/**
|
|
275
|
-
* Query parameter handling options.
|
|
276
|
-
*/
|
|
277
|
-
readonly query?: QueryOptions;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Query parameter handling options.
|
|
281
|
-
*/
|
|
282
|
-
interface QueryOptions {
|
|
283
|
-
/**
|
|
284
|
-
* How to represent query object DTOs (e.g., `@Query() dto: PaginationDto`).
|
|
285
|
-
* - `"inline"` (default): Expand DTO properties as individual query parameters
|
|
286
|
-
* - `"ref"`: Keep as a single parameter with a schema reference
|
|
287
|
-
*
|
|
288
|
-
* @default "inline"
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* ```typescript
|
|
292
|
-
* // With style: "inline" (default)
|
|
293
|
-
* // @Query() dto: PaginationDto becomes:
|
|
294
|
-
* // - page: integer (query)
|
|
295
|
-
* // - limit: integer (query)
|
|
296
|
-
*
|
|
297
|
-
* // With style: "ref"
|
|
298
|
-
* // @Query() dto: PaginationDto becomes:
|
|
299
|
-
* // - dto: $ref to PaginationDto schema (query)
|
|
300
|
-
* ```
|
|
301
|
-
*/
|
|
302
|
-
readonly style?: 'inline' | 'ref';
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Configuration for nestjs-openapi.
|
|
306
|
-
* Inspired by tsconfig.json and vite.config.ts patterns.
|
|
307
|
-
*
|
|
308
|
-
* @example
|
|
309
|
-
* ```typescript
|
|
310
|
-
* import { defineConfig } from 'nestjs-openapi';
|
|
311
|
-
*
|
|
312
|
-
* export default defineConfig({
|
|
313
|
-
* output: 'src/openapi/openapi.generated.json',
|
|
314
|
-
*
|
|
315
|
-
* files: {
|
|
316
|
-
* entry: 'src/app.module.ts',
|
|
317
|
-
* dtoGlob: 'src/**\/*.dto.ts',
|
|
318
|
-
* },
|
|
319
|
-
*
|
|
320
|
-
* openapi: {
|
|
321
|
-
* info: {
|
|
322
|
-
* title: 'My API',
|
|
323
|
-
* version: '1.0.0',
|
|
324
|
-
* },
|
|
325
|
-
* },
|
|
326
|
-
*
|
|
327
|
-
* options: {
|
|
328
|
-
* basePath: '/api',
|
|
329
|
-
* extractValidation: true,
|
|
330
|
-
* },
|
|
331
|
-
* });
|
|
332
|
-
* ```
|
|
333
|
-
*/
|
|
334
|
-
interface Config {
|
|
335
|
-
/**
|
|
336
|
-
* Extend another config file. Paths are relative to this config file.
|
|
337
|
-
* Extended config values are deeply merged, with this config taking precedence.
|
|
338
|
-
* @example extends: './configs/base-openapi.config.ts'
|
|
339
|
-
*/
|
|
340
|
-
readonly extends?: string;
|
|
341
|
-
/**
|
|
342
|
-
* Input file configuration.
|
|
343
|
-
* All paths are relative to the config file location.
|
|
344
|
-
*/
|
|
345
|
-
readonly files?: FilesConfig;
|
|
346
|
-
/**
|
|
347
|
-
* Output path for the generated OpenAPI specification.
|
|
348
|
-
* Path is relative to the config file location.
|
|
349
|
-
* @required
|
|
350
|
-
*/
|
|
351
|
-
readonly output: string;
|
|
352
|
-
/**
|
|
353
|
-
* Output format for the specification.
|
|
354
|
-
* @default "json"
|
|
355
|
-
*/
|
|
356
|
-
readonly format?: OutputFormat;
|
|
357
|
-
/**
|
|
358
|
-
* OpenAPI specification metadata.
|
|
359
|
-
* Maps directly to the OpenAPI spec structure.
|
|
360
|
-
* @required
|
|
361
|
-
*/
|
|
362
|
-
readonly openapi: OpenApiConfig;
|
|
363
|
-
/**
|
|
364
|
-
* Generation behavior options.
|
|
365
|
-
*/
|
|
366
|
-
readonly options?: OptionsConfig;
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Options for the generate function to override config values.
|
|
370
|
-
* Useful for CLI overrides.
|
|
371
|
-
*/
|
|
372
|
-
interface GenerateOverrides {
|
|
373
|
-
/**
|
|
374
|
-
* Override the output format.
|
|
375
|
-
* Takes precedence over config.format.
|
|
376
|
-
*/
|
|
377
|
-
readonly format?: OutputFormat;
|
|
378
|
-
/**
|
|
379
|
-
* Enable debug mode for verbose logging and full stack traces.
|
|
380
|
-
*/
|
|
381
|
-
readonly debug?: boolean;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* OpenAPI 3.0/3.1/3.2 specification schema object
|
|
385
|
-
* Type can be a string or array of strings (for nullable in 3.1+)
|
|
386
|
-
*/
|
|
387
|
-
interface OpenApiSchema {
|
|
388
|
-
/** Schema type - string or array for 3.1+ nullable (e.g., ['string', 'null']) */
|
|
389
|
-
readonly type?: string | readonly string[];
|
|
390
|
-
readonly format?: string;
|
|
391
|
-
readonly $ref?: string;
|
|
392
|
-
readonly oneOf?: readonly OpenApiSchema[];
|
|
393
|
-
readonly anyOf?: readonly OpenApiSchema[];
|
|
394
|
-
readonly allOf?: readonly OpenApiSchema[];
|
|
395
|
-
readonly items?: OpenApiSchema;
|
|
396
|
-
readonly properties?: Record<string, OpenApiSchema>;
|
|
397
|
-
readonly required?: readonly string[];
|
|
398
|
-
readonly enum?: readonly unknown[];
|
|
399
|
-
readonly description?: string;
|
|
400
|
-
/** OpenAPI 3.0 only - use type: [T, 'null'] in 3.1+ instead */
|
|
401
|
-
readonly nullable?: boolean;
|
|
402
|
-
/** Examples array for 3.1+ (replaces single 'example' field) */
|
|
403
|
-
readonly examples?: readonly unknown[];
|
|
404
|
-
readonly minLength?: number;
|
|
405
|
-
readonly maxLength?: number;
|
|
406
|
-
readonly pattern?: string;
|
|
407
|
-
readonly minimum?: number;
|
|
408
|
-
readonly maximum?: number;
|
|
409
|
-
readonly exclusiveMinimum?: number;
|
|
410
|
-
readonly exclusiveMaximum?: number;
|
|
411
|
-
readonly minItems?: number;
|
|
412
|
-
readonly maxItems?: number;
|
|
413
|
-
readonly default?: unknown;
|
|
414
|
-
readonly additionalProperties?: boolean | OpenApiSchema;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* OpenAPI 3.0 parameter object
|
|
418
|
-
*/
|
|
419
|
-
interface OpenApiParameter {
|
|
420
|
-
readonly name: string;
|
|
421
|
-
readonly in: 'path' | 'query' | 'header' | 'cookie';
|
|
422
|
-
readonly description?: string;
|
|
423
|
-
readonly required: boolean;
|
|
424
|
-
readonly schema: OpenApiSchema;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* OpenAPI 3.0 request body object
|
|
428
|
-
*/
|
|
429
|
-
interface OpenApiRequestBody {
|
|
430
|
-
readonly description?: string;
|
|
431
|
-
readonly required?: boolean;
|
|
432
|
-
readonly content: Record<string, {
|
|
433
|
-
readonly schema: OpenApiSchema;
|
|
434
|
-
}>;
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* OpenAPI 3.0 response object
|
|
438
|
-
*/
|
|
439
|
-
interface OpenApiResponse {
|
|
440
|
-
readonly description: string;
|
|
441
|
-
readonly content?: Record<string, {
|
|
442
|
-
readonly schema: OpenApiSchema;
|
|
443
|
-
}>;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* OpenAPI 3.0 operation object
|
|
447
|
-
*/
|
|
448
|
-
interface OpenApiOperation {
|
|
449
|
-
readonly operationId: string;
|
|
450
|
-
readonly summary?: string;
|
|
451
|
-
readonly description?: string;
|
|
452
|
-
readonly deprecated?: boolean;
|
|
453
|
-
readonly tags?: readonly string[];
|
|
454
|
-
readonly parameters?: readonly OpenApiParameter[];
|
|
455
|
-
readonly requestBody?: OpenApiRequestBody;
|
|
456
|
-
readonly responses: Record<string, OpenApiResponse>;
|
|
457
|
-
/** Per-operation security requirements (overrides global security) */
|
|
458
|
-
readonly security?: readonly SecurityRequirement[];
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* OpenAPI 3.0 paths object
|
|
462
|
-
* Maps path patterns to HTTP method operations
|
|
463
|
-
*/
|
|
464
|
-
interface OpenApiPaths {
|
|
465
|
-
readonly [path: string]: {
|
|
466
|
-
readonly [method: string]: OpenApiOperation;
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* OpenAPI 3.0 OAuth2 flow object
|
|
471
|
-
*/
|
|
472
|
-
interface OpenApiOAuth2Flow {
|
|
473
|
-
readonly authorizationUrl?: string;
|
|
474
|
-
readonly tokenUrl?: string;
|
|
475
|
-
readonly refreshUrl?: string;
|
|
476
|
-
readonly scopes: Record<string, string>;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* OpenAPI 3.0 OAuth2 flows object
|
|
480
|
-
*/
|
|
481
|
-
interface OpenApiOAuth2Flows {
|
|
482
|
-
readonly implicit?: OpenApiOAuth2Flow;
|
|
483
|
-
readonly password?: OpenApiOAuth2Flow;
|
|
484
|
-
readonly clientCredentials?: OpenApiOAuth2Flow;
|
|
485
|
-
readonly authorizationCode?: OpenApiOAuth2Flow;
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* OpenAPI 3.0 security scheme object
|
|
489
|
-
*/
|
|
490
|
-
interface OpenApiSecurityScheme {
|
|
491
|
-
readonly type: SecuritySchemeType;
|
|
492
|
-
readonly description?: string;
|
|
493
|
-
/** The name of the HTTP Authorization scheme (for type: 'http') */
|
|
494
|
-
readonly scheme?: string;
|
|
495
|
-
/** A hint for the format of the token (for type: 'http' with scheme: 'bearer') */
|
|
496
|
-
readonly bearerFormat?: string;
|
|
497
|
-
/** The location of the API key (for type: 'apiKey') */
|
|
498
|
-
readonly in?: SecuritySchemeIn;
|
|
499
|
-
/** The name of the header, query, or cookie parameter (for type: 'apiKey') */
|
|
500
|
-
readonly name?: string;
|
|
501
|
-
/** OAuth2 flows (for type: 'oauth2') */
|
|
502
|
-
readonly flows?: OpenApiOAuth2Flows;
|
|
503
|
-
/** OpenID Connect URL (for type: 'openIdConnect') */
|
|
504
|
-
readonly openIdConnectUrl?: string;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Webhook operation for OpenAPI 3.1+
|
|
508
|
-
* Similar to regular operations but accessed via events rather than HTTP methods
|
|
509
|
-
*/
|
|
510
|
-
interface OpenApiWebhookOperation {
|
|
511
|
-
readonly post?: OpenApiOperation;
|
|
512
|
-
readonly put?: OpenApiOperation;
|
|
513
|
-
readonly patch?: OpenApiOperation;
|
|
514
|
-
readonly delete?: OpenApiOperation;
|
|
515
|
-
readonly get?: OpenApiOperation;
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Complete OpenAPI 3.0/3.1/3.2 specification
|
|
519
|
-
*/
|
|
520
|
-
interface OpenApiSpec {
|
|
521
|
-
readonly openapi: OpenApiVersion;
|
|
522
|
-
readonly info: {
|
|
523
|
-
readonly title: string;
|
|
524
|
-
readonly version: string;
|
|
525
|
-
readonly description?: string;
|
|
526
|
-
readonly contact?: ContactConfig;
|
|
527
|
-
readonly license?: LicenseConfig;
|
|
528
|
-
};
|
|
529
|
-
readonly servers?: readonly ServerConfig[];
|
|
530
|
-
readonly tags?: readonly TagConfig[];
|
|
531
|
-
readonly paths: OpenApiPaths;
|
|
532
|
-
/** Webhooks for OpenAPI 3.1+ - event-driven operations */
|
|
533
|
-
readonly webhooks?: Record<string, OpenApiWebhookOperation>;
|
|
534
|
-
readonly components?: {
|
|
535
|
-
readonly schemas?: Record<string, OpenApiSchema>;
|
|
536
|
-
readonly securitySchemes?: Record<string, OpenApiSecurityScheme>;
|
|
537
|
-
};
|
|
538
|
-
/** Global security requirements */
|
|
539
|
-
readonly security?: readonly SecurityRequirement[];
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* OpenAPI spec validation utilities.
|
|
544
|
-
*
|
|
545
|
-
* Validates that generated specs don't have broken $ref references
|
|
546
|
-
* or other common issues.
|
|
547
|
-
*/
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* A broken reference found during validation
|
|
551
|
-
*/
|
|
552
|
-
interface BrokenRef {
|
|
553
|
-
/** The $ref value that couldn't be resolved */
|
|
554
|
-
readonly ref: string;
|
|
555
|
-
/** The JSON path where this reference was found */
|
|
556
|
-
readonly path: string;
|
|
557
|
-
/** The schema name that's missing (extracted from $ref) */
|
|
558
|
-
readonly missingSchema: string;
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Result of spec validation
|
|
562
|
-
*/
|
|
563
|
-
interface ValidationResult {
|
|
564
|
-
/** Whether the spec is valid (no broken refs) */
|
|
565
|
-
readonly valid: boolean;
|
|
566
|
-
/** Total number of schema refs found */
|
|
567
|
-
readonly totalRefs: number;
|
|
568
|
-
/** Number of broken refs */
|
|
569
|
-
readonly brokenRefCount: number;
|
|
570
|
-
/** Details of each broken ref */
|
|
571
|
-
readonly brokenRefs: readonly BrokenRef[];
|
|
572
|
-
/** Missing schema names grouped with their usage count */
|
|
573
|
-
readonly missingSchemas: ReadonlyMap<string, number>;
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* Validates an OpenAPI spec for broken $ref references.
|
|
577
|
-
*
|
|
578
|
-
* @param spec - The OpenAPI specification to validate
|
|
579
|
-
* @returns Validation result with details about any broken refs
|
|
580
|
-
*
|
|
581
|
-
* @example
|
|
582
|
-
* ```typescript
|
|
583
|
-
* const result = validateSpec(spec);
|
|
584
|
-
* if (!result.valid) {
|
|
585
|
-
* console.error(`Found ${result.brokenRefCount} broken refs:`);
|
|
586
|
-
* for (const [schema, count] of result.missingSchemas) {
|
|
587
|
-
* console.error(` - ${schema} (${count} usages)`);
|
|
588
|
-
* }
|
|
589
|
-
* }
|
|
590
|
-
* ```
|
|
591
|
-
*/
|
|
592
|
-
declare function validateSpec(spec: OpenApiSpec): ValidationResult;
|
|
593
|
-
/**
|
|
594
|
-
* Categorizes broken refs by likely cause
|
|
595
|
-
*/
|
|
596
|
-
interface BrokenRefCategories {
|
|
597
|
-
/** Primitive types that shouldn't be refs (string, number, boolean) */
|
|
598
|
-
readonly primitives: readonly string[];
|
|
599
|
-
/** Union types (Type | null, void | Type) */
|
|
600
|
-
readonly unionTypes: readonly string[];
|
|
601
|
-
/** Query/Path parameter DTOs */
|
|
602
|
-
readonly queryParams: readonly string[];
|
|
603
|
-
/** Other missing schemas (likely from different glob patterns) */
|
|
604
|
-
readonly other: readonly string[];
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Categorize broken refs to help diagnose the root cause.
|
|
608
|
-
*
|
|
609
|
-
* @param missingSchemas - Map of missing schema names to usage count
|
|
610
|
-
* @returns Categorized broken refs
|
|
611
|
-
*/
|
|
612
|
-
declare function categorizeBrokenRefs(missingSchemas: ReadonlyMap<string, number>): BrokenRefCategories;
|
|
613
|
-
/**
|
|
614
|
-
* Formats validation result as a human-readable string for CLI output.
|
|
615
|
-
*
|
|
616
|
-
* @param result - Validation result from validateSpec
|
|
617
|
-
* @returns Formatted string describing the validation issues
|
|
618
|
-
*/
|
|
619
|
-
declare function formatValidationResult(result: ValidationResult): string;
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* Promise-based entry point for generating OpenAPI specifications.
|
|
623
|
-
*
|
|
624
|
-
* This module provides a clean, Promise-based API that hides the internal
|
|
625
|
-
* Effect-TS implementation from consumers.
|
|
626
|
-
*/
|
|
627
|
-
|
|
628
|
-
interface GenerateResult {
|
|
629
|
-
/** Path where the OpenAPI spec was written */
|
|
630
|
-
readonly outputPath: string;
|
|
631
|
-
/** Number of paths in the generated spec */
|
|
632
|
-
readonly pathCount: number;
|
|
633
|
-
/** Number of operations in the generated spec */
|
|
634
|
-
readonly operationCount: number;
|
|
635
|
-
/** Number of schemas in the generated spec */
|
|
636
|
-
readonly schemaCount: number;
|
|
637
|
-
/** Validation result checking for broken refs */
|
|
638
|
-
readonly validation: ValidationResult;
|
|
639
|
-
}
|
|
640
|
-
/**
|
|
641
|
-
* Generates an OpenAPI specification from a NestJS application.
|
|
642
|
-
*
|
|
643
|
-
* @param configPath - Path to the configuration file (openapi.config.ts)
|
|
644
|
-
* @param options - Optional overrides for config values (e.g., format)
|
|
645
|
-
* @returns Promise that resolves with generation result when complete
|
|
646
|
-
*
|
|
647
|
-
* @example
|
|
648
|
-
* ```typescript
|
|
649
|
-
* import { generate } from 'nestjs-openapi';
|
|
650
|
-
*
|
|
651
|
-
* await generate('apps/backend-api/openapi.config.ts');
|
|
652
|
-
*
|
|
653
|
-
* // Override format from CLI
|
|
654
|
-
* await generate('apps/backend-api/openapi.config.ts', { format: 'yaml' });
|
|
655
|
-
* ```
|
|
656
|
-
*/
|
|
657
|
-
declare const generate: (configPath: string, overrides?: GenerateOverrides) => Promise<GenerateResult>;
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* Define configuration for OpenAPI generation.
|
|
661
|
-
*
|
|
662
|
-
* @example
|
|
663
|
-
* ```typescript
|
|
664
|
-
* export default defineConfig({
|
|
665
|
-
* output: 'openapi.json',
|
|
666
|
-
* files: { entry: 'src/app.module.ts' },
|
|
667
|
-
* openapi: { info: { title: 'My API', version: '1.0.0' } },
|
|
668
|
-
* });
|
|
669
|
-
* ```
|
|
670
|
-
*/
|
|
671
|
-
declare function defineConfig(config: Config): Config;
|
|
672
|
-
declare const findConfigFile: (startDir?: string) => Effect.Effect<string, ConfigNotFoundError>;
|
|
673
|
-
declare const loadConfigFromFile: (configPath: string) => Effect.Effect<typeof OpenApiGeneratorConfig.Type, ConfigError>;
|
|
674
|
-
declare const loadConfig: (configPath?: string, cwd?: string) => Effect.Effect<typeof OpenApiGeneratorConfig.Type, ConfigError>;
|
|
675
|
-
declare const resolveConfig: (config: typeof OpenApiGeneratorConfig.Type) => typeof ResolvedConfig.Type;
|
|
676
|
-
declare const loadAndResolveConfig: (configPath?: string, cwd?: string) => Effect.Effect<typeof ResolvedConfig.Type, ConfigError>;
|
|
4
|
+
import { Effect, Option, Layer } from 'effect';
|
|
5
|
+
import { ClassDeclaration, MethodDeclaration, Decorator, Symbol, ObjectLiteralExpression, Expression } from 'ts-morph';
|
|
677
6
|
|
|
678
7
|
/**
|
|
679
8
|
* NestJS Module for serving generated OpenAPI specifications at runtime.
|
|
@@ -766,6 +95,7 @@ declare function generateSwaggerUiHtml(title: string, jsonPath: string): string;
|
|
|
766
95
|
/**
|
|
767
96
|
* Load the OpenAPI spec file from disk
|
|
768
97
|
*/
|
|
98
|
+
declare const loadSpecFileEffect: (filePath: string) => Effect.Effect<OpenApiSpec, SpecFileNotFoundError | SpecFileReadError | SpecFileParseError, never>;
|
|
769
99
|
declare function loadSpecFile(filePath: string): OpenApiSpec;
|
|
770
100
|
/**
|
|
771
101
|
* Resolve options with defaults
|
|
@@ -815,39 +145,6 @@ declare class OpenApiModule {
|
|
|
815
145
|
static forRoot(options: OpenApiModuleOptions): DynamicModule;
|
|
816
146
|
}
|
|
817
147
|
|
|
818
|
-
interface ProjectContext {
|
|
819
|
-
readonly project: Project;
|
|
820
|
-
readonly entrySourceFile: SourceFile;
|
|
821
|
-
readonly entryClass: ClassDeclaration;
|
|
822
|
-
}
|
|
823
|
-
interface ProjectOptions {
|
|
824
|
-
readonly tsconfig: string;
|
|
825
|
-
readonly entry: string;
|
|
826
|
-
}
|
|
827
|
-
declare const ProjectService_base: Context.TagClass<ProjectService, "ProjectService", {
|
|
828
|
-
readonly context: ProjectContext;
|
|
829
|
-
}>;
|
|
830
|
-
/**
|
|
831
|
-
* ProjectService is an infrastructure context holder.
|
|
832
|
-
* Context.Tag is appropriate here as it holds externally-provided resources.
|
|
833
|
-
*/
|
|
834
|
-
declare class ProjectService extends ProjectService_base {
|
|
835
|
-
}
|
|
836
|
-
declare const makeProjectContext: (options: ProjectOptions) => Effect.Effect<{
|
|
837
|
-
project: Project;
|
|
838
|
-
entrySourceFile: SourceFile;
|
|
839
|
-
entryClass: ClassDeclaration;
|
|
840
|
-
}, ProjectInitError | EntryNotFoundError, never>;
|
|
841
|
-
declare const ProjectServiceLive: (options: ProjectOptions) => Layer.Layer<ProjectService, ProjectError>;
|
|
842
|
-
|
|
843
|
-
interface ModuleWithControllers {
|
|
844
|
-
readonly declaration: ClassDeclaration;
|
|
845
|
-
readonly controllers: readonly ClassDeclaration[];
|
|
846
|
-
}
|
|
847
|
-
/** Iterative BFS to avoid stack overflow on deep module graphs */
|
|
848
|
-
declare const getModules: (root: ClassDeclaration) => Effect.Effect<readonly ModuleWithControllers[], never, never>;
|
|
849
|
-
declare const getAllControllers: (root: ClassDeclaration) => Effect.Effect<ClassDeclaration[], never, never>;
|
|
850
|
-
|
|
851
148
|
declare const normalizePath: (path: string) => string;
|
|
852
149
|
declare const getControllerPrefix: (controller: ClassDeclaration) => string;
|
|
853
150
|
declare const getControllerName: (controller: ClassDeclaration) => string;
|
|
@@ -860,20 +157,159 @@ declare const getControllerTags: (controller: ClassDeclaration) => readonly stri
|
|
|
860
157
|
declare const isHttpDecorator: (decorator: Decorator) => boolean;
|
|
861
158
|
declare const getHttpDecorator: (method: MethodDeclaration) => Decorator | undefined;
|
|
862
159
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
readonly
|
|
867
|
-
|
|
868
|
-
|
|
160
|
+
declare const transformMethod: (methodInfo: MethodInfo) => OpenApiPaths;
|
|
161
|
+
declare const transformMethodEffect: (methodInfo: {
|
|
162
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
163
|
+
readonly path: string;
|
|
164
|
+
readonly methodName: string;
|
|
165
|
+
readonly controllerName: string;
|
|
166
|
+
readonly controllerTags: readonly string[];
|
|
167
|
+
readonly returnType: {
|
|
168
|
+
readonly filePath: Option.Option<string>;
|
|
169
|
+
readonly type: Option.Option<string>;
|
|
170
|
+
readonly inline: Option.Option<string>;
|
|
171
|
+
readonly container: Option.Option<"array">;
|
|
172
|
+
};
|
|
173
|
+
readonly parameters: readonly {
|
|
174
|
+
readonly name: string;
|
|
175
|
+
readonly location: "path" | "query" | "header" | "cookie" | "body";
|
|
176
|
+
readonly tsType: string;
|
|
177
|
+
readonly required: boolean;
|
|
178
|
+
readonly description: Option.Option<string>;
|
|
179
|
+
}[];
|
|
180
|
+
readonly decorators: readonly string[];
|
|
181
|
+
readonly operation: {
|
|
182
|
+
readonly description: Option.Option<string>;
|
|
183
|
+
readonly summary: Option.Option<string>;
|
|
184
|
+
readonly operationId: Option.Option<string>;
|
|
185
|
+
readonly deprecated: Option.Option<boolean>;
|
|
186
|
+
};
|
|
187
|
+
readonly responses: readonly {
|
|
188
|
+
readonly type: Option.Option<string>;
|
|
189
|
+
readonly description: Option.Option<string>;
|
|
190
|
+
readonly statusCode: number;
|
|
191
|
+
readonly isArray: boolean;
|
|
192
|
+
}[];
|
|
193
|
+
readonly httpCode: Option.Option<number>;
|
|
194
|
+
readonly consumes: readonly string[];
|
|
195
|
+
readonly produces: readonly string[];
|
|
196
|
+
readonly security: readonly {
|
|
197
|
+
readonly schemeName: string;
|
|
198
|
+
readonly scopes: readonly string[];
|
|
199
|
+
}[];
|
|
200
|
+
}) => Effect.Effect<OpenApiPaths, never, never>;
|
|
201
|
+
type MutableOpenApiPaths = {
|
|
202
|
+
[path: string]: {
|
|
203
|
+
[method: string]: OpenApiOperation;
|
|
869
204
|
};
|
|
205
|
+
};
|
|
206
|
+
declare const transformMethods: (methodInfos: readonly MethodInfo[]) => OpenApiPaths;
|
|
207
|
+
declare const transformMethodsEffect: (methodInfos: readonly {
|
|
208
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
209
|
+
readonly path: string;
|
|
210
|
+
readonly methodName: string;
|
|
211
|
+
readonly controllerName: string;
|
|
212
|
+
readonly controllerTags: readonly string[];
|
|
213
|
+
readonly returnType: {
|
|
214
|
+
readonly filePath: Option.Option<string>;
|
|
215
|
+
readonly type: Option.Option<string>;
|
|
216
|
+
readonly inline: Option.Option<string>;
|
|
217
|
+
readonly container: Option.Option<"array">;
|
|
218
|
+
};
|
|
219
|
+
readonly parameters: readonly {
|
|
220
|
+
readonly name: string;
|
|
221
|
+
readonly location: "path" | "query" | "header" | "cookie" | "body";
|
|
222
|
+
readonly tsType: string;
|
|
223
|
+
readonly required: boolean;
|
|
224
|
+
readonly description: Option.Option<string>;
|
|
225
|
+
}[];
|
|
226
|
+
readonly decorators: readonly string[];
|
|
227
|
+
readonly operation: {
|
|
228
|
+
readonly description: Option.Option<string>;
|
|
229
|
+
readonly summary: Option.Option<string>;
|
|
230
|
+
readonly operationId: Option.Option<string>;
|
|
231
|
+
readonly deprecated: Option.Option<boolean>;
|
|
232
|
+
};
|
|
233
|
+
readonly responses: readonly {
|
|
234
|
+
readonly type: Option.Option<string>;
|
|
235
|
+
readonly description: Option.Option<string>;
|
|
236
|
+
readonly statusCode: number;
|
|
237
|
+
readonly isArray: boolean;
|
|
238
|
+
}[];
|
|
239
|
+
readonly httpCode: Option.Option<number>;
|
|
240
|
+
readonly consumes: readonly string[];
|
|
241
|
+
readonly produces: readonly string[];
|
|
242
|
+
readonly security: readonly {
|
|
243
|
+
readonly schemeName: string;
|
|
244
|
+
readonly scopes: readonly string[];
|
|
245
|
+
}[];
|
|
246
|
+
}[]) => Effect.Effect<MutableOpenApiPaths, never, never>;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Schema Merger - Combines DTO schemas with path-referenced schemas
|
|
250
|
+
*
|
|
251
|
+
* This module merges generated DTO schemas into the final OpenAPI specification,
|
|
252
|
+
* ensuring all referenced schemas are included in components/schemas.
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Result of schema merging
|
|
257
|
+
*/
|
|
258
|
+
interface MergedResult {
|
|
259
|
+
/** The paths with updated $ref values */
|
|
260
|
+
readonly paths: OpenApiPaths$1;
|
|
261
|
+
/** All schemas to include in components/schemas */
|
|
262
|
+
readonly schemas: Record<string, OpenApiSchema>;
|
|
870
263
|
}
|
|
871
|
-
|
|
872
|
-
declare const
|
|
873
|
-
declare const
|
|
264
|
+
declare const mergeSchemas: (paths: OpenApiPaths$1, generatedSchemas: GeneratedSchemas) => MergedResult;
|
|
265
|
+
declare const mergeSchemasEffect: (paths: OpenApiPaths$1, generatedSchemas: GeneratedSchemas) => Effect.Effect<MergedResult, never, never>;
|
|
266
|
+
declare const mergeGeneratedSchemas: (...schemas: GeneratedSchemas[]) => GeneratedSchemas;
|
|
267
|
+
declare const mergeGeneratedSchemasEffect: (...args: GeneratedSchemas[]) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
268
|
+
declare const filterSchemas: (schemas: GeneratedSchemas, include?: readonly string[], exclude?: readonly string[]) => GeneratedSchemas;
|
|
269
|
+
declare const filterSchemasEffect: (schemas: GeneratedSchemas, include?: readonly string[] | undefined, exclude?: readonly string[] | undefined) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
874
270
|
|
|
875
|
-
|
|
876
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Schema Name Normalizer
|
|
273
|
+
*
|
|
274
|
+
* Transforms ugly generic type names into clean, readable names.
|
|
275
|
+
* For example: `SelectRule<structure-1949804971-...>` → `SelectRule`
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
interface NormalizerOptions {
|
|
279
|
+
/**
|
|
280
|
+
* Whether to preserve the base name when stripping generics
|
|
281
|
+
* @default true
|
|
282
|
+
*/
|
|
283
|
+
readonly preserveBaseName?: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Whether to deduplicate names with numeric suffixes
|
|
286
|
+
* @default false
|
|
287
|
+
*/
|
|
288
|
+
readonly deduplicateSuffixes?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Custom name mapping for specific types
|
|
291
|
+
*/
|
|
292
|
+
readonly customNames?: Record<string, string>;
|
|
293
|
+
}
|
|
294
|
+
declare const normalizeSchemas: (schemas: GeneratedSchemas, options?: NormalizerOptions) => GeneratedSchemas;
|
|
295
|
+
declare const normalizeSchemasEffect: (schemas: GeneratedSchemas, options?: NormalizerOptions | undefined) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
296
|
+
declare const filterInternalSchemas: (schemas: GeneratedSchemas) => GeneratedSchemas;
|
|
297
|
+
declare const filterInternalSchemasEffect: (schemas: GeneratedSchemas) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
298
|
+
/**
|
|
299
|
+
* Convert a string to PascalCase
|
|
300
|
+
* Examples:
|
|
301
|
+
* - `namespaceLabels` → `NamespaceLabels`
|
|
302
|
+
* - `k8sLabels` → `K8sLabels`
|
|
303
|
+
* - `NamespaceLabels` → `NamespaceLabels` (unchanged)
|
|
304
|
+
*/
|
|
305
|
+
declare const toPascalCase: (str: string) => string;
|
|
306
|
+
declare const normalizeStructureRefs: (schemas: GeneratedSchemas) => GeneratedSchemas;
|
|
307
|
+
declare const normalizeStructureRefsEffect: (schemas: GeneratedSchemas) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Shared service dependency graph for generation pipelines.
|
|
311
|
+
*/
|
|
312
|
+
declare const generatorServicesLayer: Layer.Layer<ValidationService | ConfigService | ModuleTraversalService | MethodExtractionService | SchemaService | OutputService | ProjectService, never, never>;
|
|
877
313
|
|
|
878
314
|
/** Handles aliased symbols (re-exports) */
|
|
879
315
|
declare const resolveClassFromSymbol: (sym: Symbol) => Option.Option<ClassDeclaration>;
|
|
@@ -892,5 +328,5 @@ interface ModuleMetadata {
|
|
|
892
328
|
}
|
|
893
329
|
declare const getModuleMetadata: (mod: ClassDeclaration) => ModuleMetadata;
|
|
894
330
|
|
|
895
|
-
export {
|
|
896
|
-
export type {
|
|
331
|
+
export { ConfigService, GeneratedSchemas, MethodExtractionService, MethodInfo, ModuleTraversalService, OPENAPI_MODULE_OPTIONS, OPENAPI_SPEC, OpenApiModule, OpenApiPaths$1 as OpenApiPaths, OpenApiSchema, OpenApiSpec, OutputService, ProjectService, SchemaService, SpecFileNotFoundError, SpecFileParseError, SpecFileReadError, ValidationService, filterInternalSchemas, filterInternalSchemasEffect, filterSchemas, filterSchemasEffect, generateSwaggerUiHtml, generatorServicesLayer, getArrayInitializer, getControllerName, getControllerPrefix, getControllerTags, getDecoratorName, getHttpDecorator, getHttpMethods, getModuleDecoratorArg, getModuleMetadata, getStringLiteralValue, getSymbolFromIdentifier, isHttpDecorator, isHttpMethod, isModuleClass, loadSpecFile, loadSpecFileEffect, mergeGeneratedSchemas, mergeGeneratedSchemasEffect, mergeSchemas, mergeSchemasEffect, normalizePath, normalizeSchemas, normalizeSchemasEffect, normalizeStructureRefs, normalizeStructureRefsEffect, resolveArrayOfClasses, resolveClassFromExpression, resolveClassFromSymbol, resolveOptions, toPascalCase, transformMethod, transformMethodEffect, transformMethods, transformMethodsEffect };
|
|
332
|
+
export type { MergedResult, ModuleMetadata, NormalizerOptions, OpenApiModuleOptions, ResolvedOpenApiModuleOptions, SwaggerOptions };
|