nestjs-openapi 0.1.4 → 0.2.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/dist/cli.mjs +84 -22
- package/dist/index.d.mts +157 -738
- package/dist/index.d.ts +157 -738
- 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.0ft_UaiO.mjs +5507 -0
- package/dist/shared/nestjs-openapi.C1csrdEX.d.mts +2275 -0
- package/dist/shared/nestjs-openapi.C1csrdEX.d.ts +2275 -0
- package/package.json +5 -1
- package/dist/shared/nestjs-openapi.CUKGdNSM.mjs +0 -2336
- package/dist/shared/nestjs-openapi.ClTIhsb-.d.mts +0 -440
- package/dist/shared/nestjs-openapi.ClTIhsb-.d.ts +0 -440
- package/dist/shared/nestjs-openapi.DRcy130f.mjs +0 -1571
|
@@ -0,0 +1,2275 @@
|
|
|
1
|
+
import { Schema, Effect, Option, Layer } from 'effect';
|
|
2
|
+
import { ClassDeclaration, MethodDeclaration, PropertyDeclaration, Project, SourceFile } from 'ts-morph';
|
|
3
|
+
|
|
4
|
+
declare const ProjectInitError_base: Schema.TaggedErrorClass<ProjectInitError, "ProjectInitError", {
|
|
5
|
+
readonly _tag: Schema.tag<"ProjectInitError">;
|
|
6
|
+
} & {
|
|
7
|
+
tsconfig: typeof Schema.String;
|
|
8
|
+
message: typeof Schema.String;
|
|
9
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
10
|
+
}>;
|
|
11
|
+
declare class ProjectInitError extends ProjectInitError_base {
|
|
12
|
+
static create(tsconfig: string, cause?: unknown): ProjectInitError;
|
|
13
|
+
}
|
|
14
|
+
declare const EntryNotFoundError_base: Schema.TaggedErrorClass<EntryNotFoundError, "EntryNotFoundError", {
|
|
15
|
+
readonly _tag: Schema.tag<"EntryNotFoundError">;
|
|
16
|
+
} & {
|
|
17
|
+
entry: typeof Schema.String;
|
|
18
|
+
className: typeof Schema.String;
|
|
19
|
+
message: typeof Schema.String;
|
|
20
|
+
}>;
|
|
21
|
+
declare class EntryNotFoundError extends EntryNotFoundError_base {
|
|
22
|
+
static fileNotFound(entry: string): EntryNotFoundError;
|
|
23
|
+
static classNotFound(entry: string, className: string): EntryNotFoundError;
|
|
24
|
+
}
|
|
25
|
+
type ProjectError = ProjectInitError | EntryNotFoundError;
|
|
26
|
+
declare const ConfigNotFoundError_base: Schema.TaggedErrorClass<ConfigNotFoundError, "ConfigNotFoundError", {
|
|
27
|
+
readonly _tag: Schema.tag<"ConfigNotFoundError">;
|
|
28
|
+
} & {
|
|
29
|
+
path: Schema.optional<typeof Schema.String>;
|
|
30
|
+
searchDir: Schema.optional<typeof Schema.String>;
|
|
31
|
+
message: typeof Schema.String;
|
|
32
|
+
}>;
|
|
33
|
+
declare class ConfigNotFoundError extends ConfigNotFoundError_base {
|
|
34
|
+
static notFound(searchDir: string): ConfigNotFoundError;
|
|
35
|
+
static pathNotFound(path: string): ConfigNotFoundError;
|
|
36
|
+
}
|
|
37
|
+
declare const ConfigLoadError_base: Schema.TaggedErrorClass<ConfigLoadError, "ConfigLoadError", {
|
|
38
|
+
readonly _tag: Schema.tag<"ConfigLoadError">;
|
|
39
|
+
} & {
|
|
40
|
+
path: typeof Schema.String;
|
|
41
|
+
message: typeof Schema.String;
|
|
42
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
43
|
+
}>;
|
|
44
|
+
declare class ConfigLoadError extends ConfigLoadError_base {
|
|
45
|
+
static importFailed(path: string, cause?: unknown): ConfigLoadError;
|
|
46
|
+
static noExport(path: string): ConfigLoadError;
|
|
47
|
+
static circularExtends(path: string): ConfigLoadError;
|
|
48
|
+
}
|
|
49
|
+
declare const ConfigValidationError_base: Schema.TaggedErrorClass<ConfigValidationError, "ConfigValidationError", {
|
|
50
|
+
readonly _tag: Schema.tag<"ConfigValidationError">;
|
|
51
|
+
} & {
|
|
52
|
+
path: typeof Schema.String;
|
|
53
|
+
message: typeof Schema.String;
|
|
54
|
+
issues: Schema.Array$<typeof Schema.String>;
|
|
55
|
+
}>;
|
|
56
|
+
declare class ConfigValidationError extends ConfigValidationError_base {
|
|
57
|
+
static fromIssues(path: string, issues: readonly string[]): ConfigValidationError;
|
|
58
|
+
}
|
|
59
|
+
type ConfigError = ConfigNotFoundError | ConfigLoadError | ConfigValidationError;
|
|
60
|
+
declare const InvalidMethodError_base: Schema.TaggedErrorClass<InvalidMethodError, "InvalidMethodError", {
|
|
61
|
+
readonly _tag: Schema.tag<"InvalidMethodError">;
|
|
62
|
+
} & {
|
|
63
|
+
controllerName: typeof Schema.String;
|
|
64
|
+
methodName: typeof Schema.String;
|
|
65
|
+
message: typeof Schema.String;
|
|
66
|
+
}>;
|
|
67
|
+
declare class InvalidMethodError extends InvalidMethodError_base {
|
|
68
|
+
static create(controllerName: string, methodName: string, reason: string): InvalidMethodError;
|
|
69
|
+
}
|
|
70
|
+
type AnalysisError = InvalidMethodError;
|
|
71
|
+
declare const SchemaGenerationError_base: Schema.TaggedErrorClass<SchemaGenerationError, "SchemaGenerationError", {
|
|
72
|
+
readonly _tag: Schema.tag<"SchemaGenerationError">;
|
|
73
|
+
} & {
|
|
74
|
+
message: typeof Schema.String;
|
|
75
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
76
|
+
}>;
|
|
77
|
+
declare class SchemaGenerationError extends SchemaGenerationError_base {
|
|
78
|
+
static fromError(error: unknown, context?: string): SchemaGenerationError;
|
|
79
|
+
static noFilesFound(patterns: readonly string[]): SchemaGenerationError;
|
|
80
|
+
}
|
|
81
|
+
declare const ValidationMappingError_base: Schema.TaggedErrorClass<ValidationMappingError, "ValidationMappingError", {
|
|
82
|
+
readonly _tag: Schema.tag<"ValidationMappingError">;
|
|
83
|
+
} & {
|
|
84
|
+
className: typeof Schema.String;
|
|
85
|
+
filePath: typeof Schema.String;
|
|
86
|
+
message: typeof Schema.String;
|
|
87
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
88
|
+
}>;
|
|
89
|
+
declare class ValidationMappingError extends ValidationMappingError_base {
|
|
90
|
+
static create(className: string, filePath: string, cause?: unknown): ValidationMappingError;
|
|
91
|
+
}
|
|
92
|
+
declare const MissingGenericSchemaTempFileWriteError_base: Schema.TaggedErrorClass<MissingGenericSchemaTempFileWriteError, "MissingGenericSchemaTempFileWriteError", {
|
|
93
|
+
readonly _tag: Schema.tag<"MissingGenericSchemaTempFileWriteError">;
|
|
94
|
+
} & {
|
|
95
|
+
filePath: typeof Schema.String;
|
|
96
|
+
message: typeof Schema.String;
|
|
97
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
98
|
+
}>;
|
|
99
|
+
declare class MissingGenericSchemaTempFileWriteError extends MissingGenericSchemaTempFileWriteError_base {
|
|
100
|
+
static create(filePath: string, cause?: unknown): MissingGenericSchemaTempFileWriteError;
|
|
101
|
+
}
|
|
102
|
+
declare const MissingGenericSchemaTempFileCleanupError_base: Schema.TaggedErrorClass<MissingGenericSchemaTempFileCleanupError, "MissingGenericSchemaTempFileCleanupError", {
|
|
103
|
+
readonly _tag: Schema.tag<"MissingGenericSchemaTempFileCleanupError">;
|
|
104
|
+
} & {
|
|
105
|
+
filePath: typeof Schema.String;
|
|
106
|
+
message: typeof Schema.String;
|
|
107
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
108
|
+
}>;
|
|
109
|
+
declare class MissingGenericSchemaTempFileCleanupError extends MissingGenericSchemaTempFileCleanupError_base {
|
|
110
|
+
static create(filePath: string, cause?: unknown): MissingGenericSchemaTempFileCleanupError;
|
|
111
|
+
}
|
|
112
|
+
declare const DtoGlobResolutionError_base: Schema.TaggedErrorClass<DtoGlobResolutionError, "DtoGlobResolutionError", {
|
|
113
|
+
readonly _tag: Schema.tag<"DtoGlobResolutionError">;
|
|
114
|
+
} & {
|
|
115
|
+
pattern: typeof Schema.String;
|
|
116
|
+
message: typeof Schema.String;
|
|
117
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
118
|
+
}>;
|
|
119
|
+
declare class DtoGlobResolutionError extends DtoGlobResolutionError_base {
|
|
120
|
+
static create(pattern: string, cause?: unknown): DtoGlobResolutionError;
|
|
121
|
+
}
|
|
122
|
+
declare const PublicApiError_base: Schema.TaggedErrorClass<PublicApiError, "PublicApiError", {
|
|
123
|
+
readonly _tag: Schema.tag<"PublicApiError">;
|
|
124
|
+
} & {
|
|
125
|
+
message: typeof Schema.String;
|
|
126
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
127
|
+
}>;
|
|
128
|
+
declare class PublicApiError extends PublicApiError_base {
|
|
129
|
+
static fromUnknown(cause: unknown): PublicApiError;
|
|
130
|
+
}
|
|
131
|
+
declare const SpecFileNotFoundError_base: Schema.TaggedErrorClass<SpecFileNotFoundError, "SpecFileNotFoundError", {
|
|
132
|
+
readonly _tag: Schema.tag<"SpecFileNotFoundError">;
|
|
133
|
+
} & {
|
|
134
|
+
filePath: typeof Schema.String;
|
|
135
|
+
message: typeof Schema.String;
|
|
136
|
+
}>;
|
|
137
|
+
declare class SpecFileNotFoundError extends SpecFileNotFoundError_base {
|
|
138
|
+
static create(filePath: string): SpecFileNotFoundError;
|
|
139
|
+
}
|
|
140
|
+
declare const SpecFileReadError_base: Schema.TaggedErrorClass<SpecFileReadError, "SpecFileReadError", {
|
|
141
|
+
readonly _tag: Schema.tag<"SpecFileReadError">;
|
|
142
|
+
} & {
|
|
143
|
+
filePath: typeof Schema.String;
|
|
144
|
+
message: typeof Schema.String;
|
|
145
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
146
|
+
}>;
|
|
147
|
+
declare class SpecFileReadError extends SpecFileReadError_base {
|
|
148
|
+
static create(filePath: string, cause?: unknown): SpecFileReadError;
|
|
149
|
+
}
|
|
150
|
+
declare const SpecFileParseError_base: Schema.TaggedErrorClass<SpecFileParseError, "SpecFileParseError", {
|
|
151
|
+
readonly _tag: Schema.tag<"SpecFileParseError">;
|
|
152
|
+
} & {
|
|
153
|
+
filePath: typeof Schema.String;
|
|
154
|
+
message: typeof Schema.String;
|
|
155
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
156
|
+
}>;
|
|
157
|
+
declare class SpecFileParseError extends SpecFileParseError_base {
|
|
158
|
+
static create(filePath: string, cause?: unknown): SpecFileParseError;
|
|
159
|
+
}
|
|
160
|
+
declare const OutputDirectoryCreationError_base: Schema.TaggedErrorClass<OutputDirectoryCreationError, "OutputDirectoryCreationError", {
|
|
161
|
+
readonly _tag: Schema.tag<"OutputDirectoryCreationError">;
|
|
162
|
+
} & {
|
|
163
|
+
outputDir: typeof Schema.String;
|
|
164
|
+
message: typeof Schema.String;
|
|
165
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
166
|
+
}>;
|
|
167
|
+
declare class OutputDirectoryCreationError extends OutputDirectoryCreationError_base {
|
|
168
|
+
static create(outputDir: string, cause?: unknown): OutputDirectoryCreationError;
|
|
169
|
+
}
|
|
170
|
+
declare const OutputSerializationError_base: Schema.TaggedErrorClass<OutputSerializationError, "OutputSerializationError", {
|
|
171
|
+
readonly _tag: Schema.tag<"OutputSerializationError">;
|
|
172
|
+
} & {
|
|
173
|
+
outputPath: typeof Schema.String;
|
|
174
|
+
format: Schema.Literal<["json", "yaml"]>;
|
|
175
|
+
message: typeof Schema.String;
|
|
176
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
177
|
+
}>;
|
|
178
|
+
declare class OutputSerializationError extends OutputSerializationError_base {
|
|
179
|
+
static json(outputPath: string, cause?: unknown): OutputSerializationError;
|
|
180
|
+
static yaml(outputPath: string, cause?: unknown): OutputSerializationError;
|
|
181
|
+
}
|
|
182
|
+
declare const OutputWriteError_base: Schema.TaggedErrorClass<OutputWriteError, "OutputWriteError", {
|
|
183
|
+
readonly _tag: Schema.tag<"OutputWriteError">;
|
|
184
|
+
} & {
|
|
185
|
+
outputPath: typeof Schema.String;
|
|
186
|
+
format: Schema.Literal<["json", "yaml"]>;
|
|
187
|
+
message: typeof Schema.String;
|
|
188
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
189
|
+
}>;
|
|
190
|
+
declare class OutputWriteError extends OutputWriteError_base {
|
|
191
|
+
static json(outputPath: string, cause?: unknown): OutputWriteError;
|
|
192
|
+
static yaml(outputPath: string, cause?: unknown): OutputWriteError;
|
|
193
|
+
}
|
|
194
|
+
type GeneratorError = ProjectError | ConfigError | AnalysisError | SchemaGenerationError | ValidationMappingError | MissingGenericSchemaTempFileWriteError | MissingGenericSchemaTempFileCleanupError | DtoGlobResolutionError | PublicApiError | SpecFileNotFoundError | SpecFileReadError | SpecFileParseError | OutputDirectoryCreationError | OutputSerializationError | OutputWriteError;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Public types for nestjs-openapi
|
|
198
|
+
*
|
|
199
|
+
* These types are exposed to consumers of the library. Internal types
|
|
200
|
+
* should be kept in domain.ts.
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Contact information for the API
|
|
204
|
+
*/
|
|
205
|
+
interface ContactConfig {
|
|
206
|
+
readonly name?: string;
|
|
207
|
+
readonly email?: string;
|
|
208
|
+
readonly url?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* License information for the API
|
|
212
|
+
*/
|
|
213
|
+
interface LicenseConfig {
|
|
214
|
+
readonly name: string;
|
|
215
|
+
readonly url?: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* API metadata for the OpenAPI info section
|
|
219
|
+
*/
|
|
220
|
+
interface InfoConfig {
|
|
221
|
+
readonly title: string;
|
|
222
|
+
readonly version: string;
|
|
223
|
+
readonly description?: string;
|
|
224
|
+
readonly contact?: ContactConfig;
|
|
225
|
+
readonly license?: LicenseConfig;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Server configuration for the OpenAPI servers section
|
|
229
|
+
*/
|
|
230
|
+
interface ServerConfig {
|
|
231
|
+
readonly url: string;
|
|
232
|
+
readonly description?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Tag configuration for organizing API endpoints
|
|
236
|
+
*/
|
|
237
|
+
interface TagConfig {
|
|
238
|
+
readonly name: string;
|
|
239
|
+
readonly description?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Security scheme type for OpenAPI 3.0
|
|
243
|
+
*/
|
|
244
|
+
type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
245
|
+
/**
|
|
246
|
+
* Location for apiKey security schemes
|
|
247
|
+
*/
|
|
248
|
+
type SecuritySchemeIn = 'query' | 'header' | 'cookie';
|
|
249
|
+
/**
|
|
250
|
+
* OAuth2 flow configuration
|
|
251
|
+
*/
|
|
252
|
+
interface OAuth2FlowConfig {
|
|
253
|
+
readonly authorizationUrl?: string;
|
|
254
|
+
readonly tokenUrl?: string;
|
|
255
|
+
readonly refreshUrl?: string;
|
|
256
|
+
readonly scopes?: Record<string, string>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* OAuth2 flows configuration
|
|
260
|
+
*/
|
|
261
|
+
interface OAuth2FlowsConfig {
|
|
262
|
+
readonly implicit?: OAuth2FlowConfig;
|
|
263
|
+
readonly password?: OAuth2FlowConfig;
|
|
264
|
+
readonly clientCredentials?: OAuth2FlowConfig;
|
|
265
|
+
readonly authorizationCode?: OAuth2FlowConfig;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Security scheme configuration for OpenAPI 3.0
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* // Bearer token (JWT)
|
|
273
|
+
* {
|
|
274
|
+
* name: 'bearerAuth',
|
|
275
|
+
* type: 'http',
|
|
276
|
+
* scheme: 'bearer',
|
|
277
|
+
* bearerFormat: 'JWT',
|
|
278
|
+
* }
|
|
279
|
+
*
|
|
280
|
+
* // API Key in header
|
|
281
|
+
* {
|
|
282
|
+
* name: 'apiKey',
|
|
283
|
+
* type: 'apiKey',
|
|
284
|
+
* in: 'header',
|
|
285
|
+
* parameterName: 'X-API-Key',
|
|
286
|
+
* }
|
|
287
|
+
*
|
|
288
|
+
* // OAuth2
|
|
289
|
+
* {
|
|
290
|
+
* name: 'oauth2',
|
|
291
|
+
* type: 'oauth2',
|
|
292
|
+
* flows: {
|
|
293
|
+
* authorizationCode: {
|
|
294
|
+
* authorizationUrl: 'https://example.com/oauth/authorize',
|
|
295
|
+
* tokenUrl: 'https://example.com/oauth/token',
|
|
296
|
+
* scopes: { 'read:users': 'Read user data' },
|
|
297
|
+
* },
|
|
298
|
+
* },
|
|
299
|
+
* }
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
interface SecuritySchemeConfig {
|
|
303
|
+
/** Unique name for this security scheme (used as key in securitySchemes) */
|
|
304
|
+
readonly name: string;
|
|
305
|
+
/** The type of the security scheme */
|
|
306
|
+
readonly type: SecuritySchemeType;
|
|
307
|
+
/** Description of the security scheme */
|
|
308
|
+
readonly description?: string;
|
|
309
|
+
/** The name of the HTTP Authorization scheme (for type: 'http') */
|
|
310
|
+
readonly scheme?: string;
|
|
311
|
+
/** A hint for the format of the token (for type: 'http' with scheme: 'bearer') */
|
|
312
|
+
readonly bearerFormat?: string;
|
|
313
|
+
/** The location of the API key (for type: 'apiKey') */
|
|
314
|
+
readonly in?: SecuritySchemeIn;
|
|
315
|
+
/** The name of the header, query, or cookie parameter (for type: 'apiKey') */
|
|
316
|
+
readonly parameterName?: string;
|
|
317
|
+
/** OAuth2 flows configuration (for type: 'oauth2') */
|
|
318
|
+
readonly flows?: OAuth2FlowsConfig;
|
|
319
|
+
/** OpenID Connect URL to discover OAuth2 config (for type: 'openIdConnect') */
|
|
320
|
+
readonly openIdConnectUrl?: string;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Security requirement - maps security scheme names to required scopes
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* // Require bearerAuth with no specific scopes
|
|
328
|
+
* { bearerAuth: [] }
|
|
329
|
+
*
|
|
330
|
+
* // Require oauth2 with specific scopes
|
|
331
|
+
* { oauth2: ['read:users', 'write:users'] }
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
type SecurityRequirement = Record<string, readonly string[]>;
|
|
335
|
+
/**
|
|
336
|
+
* Output format for the generated OpenAPI specification
|
|
337
|
+
*/
|
|
338
|
+
type OutputFormat = 'json' | 'yaml';
|
|
339
|
+
/**
|
|
340
|
+
* OpenAPI specification version
|
|
341
|
+
* - '3.0.3': OpenAPI 3.0.3 (default, widely supported)
|
|
342
|
+
* - '3.1.0': OpenAPI 3.1.0 (full JSON Schema 2020-12 alignment, type arrays for nullable)
|
|
343
|
+
* - '3.2.0': OpenAPI 3.2.0 (when released, will include webhooks and other new features)
|
|
344
|
+
*/
|
|
345
|
+
type OpenApiVersion = '3.0.3' | '3.1.0' | '3.2.0';
|
|
346
|
+
/**
|
|
347
|
+
* Input file configuration for nestjs-openapi.
|
|
348
|
+
* All paths are relative to the config file location.
|
|
349
|
+
*/
|
|
350
|
+
interface FilesConfig {
|
|
351
|
+
/**
|
|
352
|
+
* Entry module file(s).
|
|
353
|
+
* @default "src/app.module.ts"
|
|
354
|
+
*/
|
|
355
|
+
readonly entry?: string | readonly string[];
|
|
356
|
+
/**
|
|
357
|
+
* Path to tsconfig.json. Auto-detected if not specified.
|
|
358
|
+
*/
|
|
359
|
+
readonly tsconfig?: string;
|
|
360
|
+
/**
|
|
361
|
+
* Glob pattern(s) for DTO files to generate schemas from.
|
|
362
|
+
* @example "src/**\/*.dto.ts"
|
|
363
|
+
*/
|
|
364
|
+
readonly dtoGlob?: string | readonly string[];
|
|
365
|
+
/**
|
|
366
|
+
* Glob patterns to include.
|
|
367
|
+
*/
|
|
368
|
+
readonly include?: readonly string[];
|
|
369
|
+
/**
|
|
370
|
+
* Glob patterns to exclude.
|
|
371
|
+
* @default ["**\/*.spec.ts", "**\/*.test.ts", "**\/node_modules/**"]
|
|
372
|
+
*/
|
|
373
|
+
readonly exclude?: readonly string[];
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Security configuration for OpenAPI spec.
|
|
377
|
+
*/
|
|
378
|
+
interface SecurityConfig {
|
|
379
|
+
/**
|
|
380
|
+
* Security schemes available for the API.
|
|
381
|
+
* Defines authentication methods (bearer, apiKey, oauth2, etc.)
|
|
382
|
+
*/
|
|
383
|
+
readonly schemes?: readonly SecuritySchemeConfig[];
|
|
384
|
+
/**
|
|
385
|
+
* Global security requirements applied to all operations.
|
|
386
|
+
* Can be overridden at the operation level.
|
|
387
|
+
* Each object in the array represents an alternative (OR logic).
|
|
388
|
+
* Within each object, all schemes must be satisfied (AND logic).
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```typescript
|
|
392
|
+
* // Require bearerAuth for all operations
|
|
393
|
+
* global: [{ bearerAuth: [] }]
|
|
394
|
+
*
|
|
395
|
+
* // Allow either bearerAuth OR apiKey
|
|
396
|
+
* global: [{ bearerAuth: [] }, { apiKey: [] }]
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
readonly global?: readonly SecurityRequirement[];
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* OpenAPI specification metadata configuration.
|
|
403
|
+
* Maps directly to the OpenAPI spec structure.
|
|
404
|
+
*/
|
|
405
|
+
interface OpenApiConfig {
|
|
406
|
+
/**
|
|
407
|
+
* OpenAPI specification version.
|
|
408
|
+
* @default "3.0.3"
|
|
409
|
+
*/
|
|
410
|
+
readonly version?: OpenApiVersion;
|
|
411
|
+
/**
|
|
412
|
+
* API metadata for the info section.
|
|
413
|
+
* @required
|
|
414
|
+
*/
|
|
415
|
+
readonly info: InfoConfig;
|
|
416
|
+
/**
|
|
417
|
+
* Server URLs for the API.
|
|
418
|
+
*/
|
|
419
|
+
readonly servers?: readonly ServerConfig[];
|
|
420
|
+
/**
|
|
421
|
+
* Tags for organizing API endpoints.
|
|
422
|
+
*/
|
|
423
|
+
readonly tags?: readonly TagConfig[];
|
|
424
|
+
/**
|
|
425
|
+
* Security configuration.
|
|
426
|
+
*/
|
|
427
|
+
readonly security?: SecurityConfig;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Generation behavior options.
|
|
431
|
+
*/
|
|
432
|
+
interface OptionsConfig {
|
|
433
|
+
/**
|
|
434
|
+
* Base path prefix for all routes.
|
|
435
|
+
* Equivalent to NestJS's app.setGlobalPrefix().
|
|
436
|
+
* @example "/api/v1"
|
|
437
|
+
*/
|
|
438
|
+
readonly basePath?: string;
|
|
439
|
+
/**
|
|
440
|
+
* Extract validation constraints from class-validator decorators.
|
|
441
|
+
* @default true
|
|
442
|
+
*/
|
|
443
|
+
readonly extractValidation?: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Decorator names that exclude endpoints from the spec.
|
|
446
|
+
* @default ["ApiExcludeEndpoint", "ApiExcludeController"]
|
|
447
|
+
*/
|
|
448
|
+
readonly excludeDecorators?: readonly string[];
|
|
449
|
+
/**
|
|
450
|
+
* Filter paths by regex or predicate function.
|
|
451
|
+
* Paths matching the regex (or returning true) are INCLUDED.
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* // Exclude internal and versioned paths
|
|
456
|
+
* pathFilter: /^(?!.*(\/internal\/|\/v[\d.]+\/)).* /
|
|
457
|
+
*
|
|
458
|
+
* // Using a function
|
|
459
|
+
* pathFilter: (path) => !path.includes('/internal/')
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
readonly pathFilter?: RegExp | ((path: string) => boolean);
|
|
463
|
+
/**
|
|
464
|
+
* Query parameter handling options.
|
|
465
|
+
*/
|
|
466
|
+
readonly query?: QueryOptions;
|
|
467
|
+
/**
|
|
468
|
+
* Schema generation and normalization options.
|
|
469
|
+
*/
|
|
470
|
+
readonly schemas?: SchemaOptions;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Schema generation and normalization options.
|
|
474
|
+
*/
|
|
475
|
+
interface SchemaOptions {
|
|
476
|
+
/**
|
|
477
|
+
* How to handle schema aliases that only redirect via `$ref`.
|
|
478
|
+
* - `"collapse"`: Rewrite refs to the final target schema and remove alias entries
|
|
479
|
+
* - `"preserve"`: Keep alias schemas as-is
|
|
480
|
+
*
|
|
481
|
+
* @default "collapse"
|
|
482
|
+
*/
|
|
483
|
+
readonly aliasRefs?: 'collapse' | 'preserve';
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Query parameter handling options.
|
|
487
|
+
*/
|
|
488
|
+
interface QueryOptions {
|
|
489
|
+
/**
|
|
490
|
+
* How to represent query object DTOs (e.g., `@Query() dto: PaginationDto`).
|
|
491
|
+
* - `"inline"` (default): Expand DTO properties as individual query parameters
|
|
492
|
+
* - `"ref"`: Keep as a single parameter with a schema reference
|
|
493
|
+
*
|
|
494
|
+
* @default "inline"
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* // With style: "inline" (default)
|
|
499
|
+
* // @Query() dto: PaginationDto becomes:
|
|
500
|
+
* // - page: integer (query)
|
|
501
|
+
* // - limit: integer (query)
|
|
502
|
+
*
|
|
503
|
+
* // With style: "ref"
|
|
504
|
+
* // @Query() dto: PaginationDto becomes:
|
|
505
|
+
* // - dto: $ref to PaginationDto schema (query)
|
|
506
|
+
* ```
|
|
507
|
+
*/
|
|
508
|
+
readonly style?: 'inline' | 'ref';
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Configuration for nestjs-openapi.
|
|
512
|
+
* Inspired by tsconfig.json and vite.config.ts patterns.
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
* import { defineConfig } from 'nestjs-openapi';
|
|
517
|
+
*
|
|
518
|
+
* export default defineConfig({
|
|
519
|
+
* output: 'src/openapi/openapi.generated.json',
|
|
520
|
+
*
|
|
521
|
+
* files: {
|
|
522
|
+
* entry: 'src/app.module.ts',
|
|
523
|
+
* dtoGlob: 'src/**\/*.dto.ts',
|
|
524
|
+
* },
|
|
525
|
+
*
|
|
526
|
+
* openapi: {
|
|
527
|
+
* info: {
|
|
528
|
+
* title: 'My API',
|
|
529
|
+
* version: '1.0.0',
|
|
530
|
+
* },
|
|
531
|
+
* },
|
|
532
|
+
*
|
|
533
|
+
* options: {
|
|
534
|
+
* basePath: '/api',
|
|
535
|
+
* extractValidation: true,
|
|
536
|
+
* },
|
|
537
|
+
* });
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
interface Config {
|
|
541
|
+
/**
|
|
542
|
+
* Extend another config file. Paths are relative to this config file.
|
|
543
|
+
* Extended config values are deeply merged, with this config taking precedence.
|
|
544
|
+
* @example extends: './configs/base-openapi.config.ts'
|
|
545
|
+
*/
|
|
546
|
+
readonly extends?: string;
|
|
547
|
+
/**
|
|
548
|
+
* Input file configuration.
|
|
549
|
+
* All paths are relative to the config file location.
|
|
550
|
+
*/
|
|
551
|
+
readonly files?: FilesConfig;
|
|
552
|
+
/**
|
|
553
|
+
* Output path for the generated OpenAPI specification.
|
|
554
|
+
* Path is relative to the config file location.
|
|
555
|
+
* @required
|
|
556
|
+
*/
|
|
557
|
+
readonly output: string;
|
|
558
|
+
/**
|
|
559
|
+
* Output format for the specification.
|
|
560
|
+
* @default "json"
|
|
561
|
+
*/
|
|
562
|
+
readonly format?: OutputFormat;
|
|
563
|
+
/**
|
|
564
|
+
* OpenAPI specification metadata.
|
|
565
|
+
* Maps directly to the OpenAPI spec structure.
|
|
566
|
+
* @required
|
|
567
|
+
*/
|
|
568
|
+
readonly openapi: OpenApiConfig;
|
|
569
|
+
/**
|
|
570
|
+
* Generation behavior options.
|
|
571
|
+
*/
|
|
572
|
+
readonly options?: OptionsConfig;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Options for the generate function to override config values.
|
|
576
|
+
* Useful for CLI overrides.
|
|
577
|
+
*/
|
|
578
|
+
interface GenerateOverrides {
|
|
579
|
+
/**
|
|
580
|
+
* Override the output format.
|
|
581
|
+
* Takes precedence over config.format.
|
|
582
|
+
*/
|
|
583
|
+
readonly format?: OutputFormat;
|
|
584
|
+
/**
|
|
585
|
+
* Enable debug mode for verbose logging and full stack traces.
|
|
586
|
+
*/
|
|
587
|
+
readonly debug?: boolean;
|
|
588
|
+
/**
|
|
589
|
+
* Optional OpenTelemetry tracing for profiling generation performance.
|
|
590
|
+
*/
|
|
591
|
+
readonly telemetry?: TelemetryConfig;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* OpenTelemetry tracing options.
|
|
595
|
+
*/
|
|
596
|
+
interface TelemetryConfig {
|
|
597
|
+
/**
|
|
598
|
+
* Enable OpenTelemetry tracing.
|
|
599
|
+
* @default false
|
|
600
|
+
*/
|
|
601
|
+
readonly enabled?: boolean;
|
|
602
|
+
/**
|
|
603
|
+
* Span exporter backend.
|
|
604
|
+
* - "console": writes spans to stdout
|
|
605
|
+
* - "otlp": sends spans to OTLP HTTP collector
|
|
606
|
+
* @default "console"
|
|
607
|
+
*/
|
|
608
|
+
readonly exporter?: 'console' | 'otlp';
|
|
609
|
+
/**
|
|
610
|
+
* OTLP HTTP endpoint.
|
|
611
|
+
* Used only when exporter is "otlp".
|
|
612
|
+
* @default "http://localhost:4318/v1/traces"
|
|
613
|
+
*/
|
|
614
|
+
readonly otlpEndpoint?: string;
|
|
615
|
+
/**
|
|
616
|
+
* Service name attached to emitted traces.
|
|
617
|
+
* @default "nestjs-openapi"
|
|
618
|
+
*/
|
|
619
|
+
readonly serviceName?: string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* OpenAPI 3.0/3.1/3.2 specification schema object
|
|
623
|
+
* Type can be a string or array of strings (for nullable in 3.1+)
|
|
624
|
+
*/
|
|
625
|
+
interface OpenApiSchema$1 {
|
|
626
|
+
/** Schema type - string or array for 3.1+ nullable (e.g., ['string', 'null']) */
|
|
627
|
+
readonly type?: string | readonly string[];
|
|
628
|
+
readonly format?: string;
|
|
629
|
+
readonly $ref?: string;
|
|
630
|
+
readonly oneOf?: readonly OpenApiSchema$1[];
|
|
631
|
+
readonly anyOf?: readonly OpenApiSchema$1[];
|
|
632
|
+
readonly allOf?: readonly OpenApiSchema$1[];
|
|
633
|
+
readonly items?: OpenApiSchema$1;
|
|
634
|
+
readonly properties?: Record<string, OpenApiSchema$1>;
|
|
635
|
+
readonly required?: readonly string[];
|
|
636
|
+
readonly enum?: readonly unknown[];
|
|
637
|
+
readonly description?: string;
|
|
638
|
+
/** OpenAPI 3.0 only - use type: [T, 'null'] in 3.1+ instead */
|
|
639
|
+
readonly nullable?: boolean;
|
|
640
|
+
/** Examples array for 3.1+ (replaces single 'example' field) */
|
|
641
|
+
readonly examples?: readonly unknown[];
|
|
642
|
+
readonly minLength?: number;
|
|
643
|
+
readonly maxLength?: number;
|
|
644
|
+
readonly pattern?: string;
|
|
645
|
+
readonly minimum?: number;
|
|
646
|
+
readonly maximum?: number;
|
|
647
|
+
readonly exclusiveMinimum?: number;
|
|
648
|
+
readonly exclusiveMaximum?: number;
|
|
649
|
+
readonly minItems?: number;
|
|
650
|
+
readonly maxItems?: number;
|
|
651
|
+
readonly default?: unknown;
|
|
652
|
+
readonly additionalProperties?: boolean | OpenApiSchema$1;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* OpenAPI 3.0 parameter object
|
|
656
|
+
*/
|
|
657
|
+
interface OpenApiParameter {
|
|
658
|
+
readonly name: string;
|
|
659
|
+
readonly in: 'path' | 'query' | 'header' | 'cookie';
|
|
660
|
+
readonly description?: string;
|
|
661
|
+
readonly required: boolean;
|
|
662
|
+
readonly schema: OpenApiSchema$1;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* OpenAPI 3.0 request body object
|
|
666
|
+
*/
|
|
667
|
+
interface OpenApiRequestBody {
|
|
668
|
+
readonly description?: string;
|
|
669
|
+
readonly required?: boolean;
|
|
670
|
+
readonly content: Record<string, {
|
|
671
|
+
readonly schema: OpenApiSchema$1;
|
|
672
|
+
}>;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* OpenAPI 3.0 response object
|
|
676
|
+
*/
|
|
677
|
+
interface OpenApiResponse {
|
|
678
|
+
readonly description: string;
|
|
679
|
+
readonly content?: Record<string, {
|
|
680
|
+
readonly schema: OpenApiSchema$1;
|
|
681
|
+
}>;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* OpenAPI 3.0 operation object
|
|
685
|
+
*/
|
|
686
|
+
interface OpenApiOperation$1 {
|
|
687
|
+
readonly operationId: string;
|
|
688
|
+
readonly summary?: string;
|
|
689
|
+
readonly description?: string;
|
|
690
|
+
readonly deprecated?: boolean;
|
|
691
|
+
readonly tags?: readonly string[];
|
|
692
|
+
readonly parameters?: readonly OpenApiParameter[];
|
|
693
|
+
readonly requestBody?: OpenApiRequestBody;
|
|
694
|
+
readonly responses: Record<string, OpenApiResponse>;
|
|
695
|
+
/** Per-operation security requirements (overrides global security) */
|
|
696
|
+
readonly security?: readonly SecurityRequirement[];
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* OpenAPI 3.0 paths object
|
|
700
|
+
* Maps path patterns to HTTP method operations
|
|
701
|
+
*/
|
|
702
|
+
interface OpenApiPaths$1 {
|
|
703
|
+
readonly [path: string]: {
|
|
704
|
+
readonly [method: string]: OpenApiOperation$1;
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* OpenAPI 3.0 OAuth2 flow object
|
|
709
|
+
*/
|
|
710
|
+
interface OpenApiOAuth2Flow {
|
|
711
|
+
readonly authorizationUrl?: string;
|
|
712
|
+
readonly tokenUrl?: string;
|
|
713
|
+
readonly refreshUrl?: string;
|
|
714
|
+
readonly scopes: Record<string, string>;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* OpenAPI 3.0 OAuth2 flows object
|
|
718
|
+
*/
|
|
719
|
+
interface OpenApiOAuth2Flows {
|
|
720
|
+
readonly implicit?: OpenApiOAuth2Flow;
|
|
721
|
+
readonly password?: OpenApiOAuth2Flow;
|
|
722
|
+
readonly clientCredentials?: OpenApiOAuth2Flow;
|
|
723
|
+
readonly authorizationCode?: OpenApiOAuth2Flow;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* OpenAPI 3.0 security scheme object
|
|
727
|
+
*/
|
|
728
|
+
interface OpenApiSecurityScheme {
|
|
729
|
+
readonly type: SecuritySchemeType;
|
|
730
|
+
readonly description?: string;
|
|
731
|
+
/** The name of the HTTP Authorization scheme (for type: 'http') */
|
|
732
|
+
readonly scheme?: string;
|
|
733
|
+
/** A hint for the format of the token (for type: 'http' with scheme: 'bearer') */
|
|
734
|
+
readonly bearerFormat?: string;
|
|
735
|
+
/** The location of the API key (for type: 'apiKey') */
|
|
736
|
+
readonly in?: SecuritySchemeIn;
|
|
737
|
+
/** The name of the header, query, or cookie parameter (for type: 'apiKey') */
|
|
738
|
+
readonly name?: string;
|
|
739
|
+
/** OAuth2 flows (for type: 'oauth2') */
|
|
740
|
+
readonly flows?: OpenApiOAuth2Flows;
|
|
741
|
+
/** OpenID Connect URL (for type: 'openIdConnect') */
|
|
742
|
+
readonly openIdConnectUrl?: string;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Webhook operation for OpenAPI 3.1+
|
|
746
|
+
* Similar to regular operations but accessed via events rather than HTTP methods
|
|
747
|
+
*/
|
|
748
|
+
interface OpenApiWebhookOperation {
|
|
749
|
+
readonly post?: OpenApiOperation$1;
|
|
750
|
+
readonly put?: OpenApiOperation$1;
|
|
751
|
+
readonly patch?: OpenApiOperation$1;
|
|
752
|
+
readonly delete?: OpenApiOperation$1;
|
|
753
|
+
readonly get?: OpenApiOperation$1;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Complete OpenAPI 3.0/3.1/3.2 specification
|
|
757
|
+
*/
|
|
758
|
+
interface OpenApiSpec {
|
|
759
|
+
readonly openapi: OpenApiVersion;
|
|
760
|
+
readonly info: {
|
|
761
|
+
readonly title: string;
|
|
762
|
+
readonly version: string;
|
|
763
|
+
readonly description?: string;
|
|
764
|
+
readonly contact?: ContactConfig;
|
|
765
|
+
readonly license?: LicenseConfig;
|
|
766
|
+
};
|
|
767
|
+
readonly servers?: readonly ServerConfig[];
|
|
768
|
+
readonly tags?: readonly TagConfig[];
|
|
769
|
+
readonly paths: OpenApiPaths$1;
|
|
770
|
+
/** Webhooks for OpenAPI 3.1+ - event-driven operations */
|
|
771
|
+
readonly webhooks?: Record<string, OpenApiWebhookOperation>;
|
|
772
|
+
readonly components?: {
|
|
773
|
+
readonly schemas?: Record<string, OpenApiSchema$1>;
|
|
774
|
+
readonly securitySchemes?: Record<string, OpenApiSecurityScheme>;
|
|
775
|
+
};
|
|
776
|
+
/** Global security requirements */
|
|
777
|
+
readonly security?: readonly SecurityRequirement[];
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
interface ModuleWithControllers {
|
|
781
|
+
readonly declaration: ClassDeclaration;
|
|
782
|
+
readonly controllers: readonly ClassDeclaration[];
|
|
783
|
+
}
|
|
784
|
+
/** Iterative BFS to avoid stack overflow on deep module graphs */
|
|
785
|
+
declare const getModules: (root: ClassDeclaration) => Effect.Effect<readonly ModuleWithControllers[], never, never>;
|
|
786
|
+
declare const getAllControllers: (root: ClassDeclaration) => Effect.Effect<ClassDeclaration[], never, never>;
|
|
787
|
+
declare const ModuleTraversalService_base: Effect.Service.Class<ModuleTraversalService, "ModuleTraversalService", {
|
|
788
|
+
readonly accessors: true;
|
|
789
|
+
readonly effect: Effect.Effect<{
|
|
790
|
+
getModules: (root: ClassDeclaration) => Effect.Effect<readonly ModuleWithControllers[], never, never>;
|
|
791
|
+
getAllControllers: (root: ClassDeclaration) => Effect.Effect<ClassDeclaration[], never, never>;
|
|
792
|
+
}, never, never>;
|
|
793
|
+
}>;
|
|
794
|
+
declare class ModuleTraversalService extends ModuleTraversalService_base {
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
declare const ParameterLocation: Schema.Literal<["path", "query", "header", "cookie", "body"]>;
|
|
798
|
+
type ParameterLocation = typeof ParameterLocation.Type;
|
|
799
|
+
/** Validation constraints that can be applied to parameters (plain interface for perf) */
|
|
800
|
+
interface ParameterConstraints {
|
|
801
|
+
readonly minLength?: number;
|
|
802
|
+
readonly maxLength?: number;
|
|
803
|
+
readonly pattern?: string;
|
|
804
|
+
readonly format?: string;
|
|
805
|
+
readonly minimum?: number;
|
|
806
|
+
readonly maximum?: number;
|
|
807
|
+
readonly exclusiveMinimum?: number | boolean;
|
|
808
|
+
readonly exclusiveMaximum?: number | boolean;
|
|
809
|
+
readonly minItems?: number;
|
|
810
|
+
readonly maxItems?: number;
|
|
811
|
+
readonly enum?: readonly unknown[];
|
|
812
|
+
readonly type?: string;
|
|
813
|
+
}
|
|
814
|
+
declare const ResolvedParameter: Schema.Struct<{
|
|
815
|
+
name: typeof Schema.String;
|
|
816
|
+
location: Schema.Literal<["path", "query", "header", "cookie", "body"]>;
|
|
817
|
+
tsType: typeof Schema.String;
|
|
818
|
+
required: typeof Schema.Boolean;
|
|
819
|
+
description: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
820
|
+
}>;
|
|
821
|
+
interface ResolvedParameter extends Schema.Schema.Type<typeof ResolvedParameter> {
|
|
822
|
+
/** Validation constraints from decorators like @Min, @Max, @IsEnum, etc. */
|
|
823
|
+
readonly constraints?: ParameterConstraints;
|
|
824
|
+
}
|
|
825
|
+
declare const ReturnTypeInfo: Schema.Struct<{
|
|
826
|
+
type: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
827
|
+
inline: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
828
|
+
container: Schema.OptionFromNullOr<Schema.Literal<["array"]>>;
|
|
829
|
+
filePath: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
830
|
+
}>;
|
|
831
|
+
type ReturnTypeInfo = typeof ReturnTypeInfo.Type;
|
|
832
|
+
declare const HttpMethod: Schema.Literal<["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD", "ALL"]>;
|
|
833
|
+
type HttpMethod = typeof HttpMethod.Type;
|
|
834
|
+
declare const MethodInfo: Schema.Struct<{
|
|
835
|
+
httpMethod: Schema.Literal<["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD", "ALL"]>;
|
|
836
|
+
path: typeof Schema.String;
|
|
837
|
+
methodName: typeof Schema.String;
|
|
838
|
+
controllerName: typeof Schema.String;
|
|
839
|
+
controllerTags: Schema.Array$<typeof Schema.String>;
|
|
840
|
+
returnType: Schema.Struct<{
|
|
841
|
+
type: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
842
|
+
inline: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
843
|
+
container: Schema.OptionFromNullOr<Schema.Literal<["array"]>>;
|
|
844
|
+
filePath: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
845
|
+
}>;
|
|
846
|
+
parameters: Schema.Array$<Schema.Struct<{
|
|
847
|
+
name: typeof Schema.String;
|
|
848
|
+
location: Schema.Literal<["path", "query", "header", "cookie", "body"]>;
|
|
849
|
+
tsType: typeof Schema.String;
|
|
850
|
+
required: typeof Schema.Boolean;
|
|
851
|
+
description: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
852
|
+
}>>;
|
|
853
|
+
/** All decorator names on the controller and method (for filtering) */
|
|
854
|
+
decorators: Schema.Array$<typeof Schema.String>;
|
|
855
|
+
/** Metadata from @ApiOperation decorator */
|
|
856
|
+
operation: Schema.Struct<{
|
|
857
|
+
/** Custom summary from @ApiOperation({ summary: '...' }) */
|
|
858
|
+
summary: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
859
|
+
/** Description from @ApiOperation({ description: '...' }) */
|
|
860
|
+
description: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
861
|
+
/** Custom operationId from @ApiOperation({ operationId: '...' }) */
|
|
862
|
+
operationId: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
863
|
+
/** Deprecated flag from @ApiOperation({ deprecated: true }) */
|
|
864
|
+
deprecated: Schema.OptionFromNullOr<typeof Schema.Boolean>;
|
|
865
|
+
}>;
|
|
866
|
+
/** Response metadata from @ApiResponse decorators */
|
|
867
|
+
responses: Schema.Array$<Schema.Struct<{
|
|
868
|
+
/** HTTP status code (e.g., 200, 201, 400, 404) */
|
|
869
|
+
statusCode: typeof Schema.Number;
|
|
870
|
+
/** Response description */
|
|
871
|
+
description: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
872
|
+
/** Response type name (e.g., "UserDto") */
|
|
873
|
+
type: Schema.OptionFromNullOr<typeof Schema.String>;
|
|
874
|
+
/** Whether the response type is an array */
|
|
875
|
+
isArray: typeof Schema.Boolean;
|
|
876
|
+
}>>;
|
|
877
|
+
/** Custom HTTP code from @HttpCode decorator */
|
|
878
|
+
httpCode: Schema.OptionFromNullOr<typeof Schema.Number>;
|
|
879
|
+
/** Content types from @ApiConsumes decorator (request body content types) */
|
|
880
|
+
consumes: Schema.Array$<typeof Schema.String>;
|
|
881
|
+
/** Content types from @ApiProduces decorator (response content types) */
|
|
882
|
+
produces: Schema.Array$<typeof Schema.String>;
|
|
883
|
+
/**
|
|
884
|
+
* Security requirements from decorators (@ApiBearerAuth, @ApiSecurity, etc.)
|
|
885
|
+
* Combines controller-level and method-level security.
|
|
886
|
+
* Multiple requirements = AND logic (all required).
|
|
887
|
+
* Empty array = no security decorators found (inherits global security).
|
|
888
|
+
*/
|
|
889
|
+
security: Schema.Array$<Schema.Struct<{
|
|
890
|
+
/** Security scheme name (e.g., 'bearer', 'jwt', 'oauth2') */
|
|
891
|
+
schemeName: typeof Schema.String;
|
|
892
|
+
/** Required scopes (empty array for schemes without scopes) */
|
|
893
|
+
scopes: Schema.Array$<typeof Schema.String>;
|
|
894
|
+
}>>;
|
|
895
|
+
}>;
|
|
896
|
+
type MethodInfo = typeof MethodInfo.Type;
|
|
897
|
+
interface OpenApiSchema {
|
|
898
|
+
readonly type?: string;
|
|
899
|
+
readonly format?: string;
|
|
900
|
+
readonly $ref?: string;
|
|
901
|
+
readonly oneOf?: readonly OpenApiSchema[];
|
|
902
|
+
readonly allOf?: readonly OpenApiSchema[];
|
|
903
|
+
readonly items?: OpenApiSchema;
|
|
904
|
+
readonly properties?: Record<string, OpenApiSchema>;
|
|
905
|
+
readonly required?: readonly string[];
|
|
906
|
+
/** OpenAPI 3.0 nullable flag */
|
|
907
|
+
readonly nullable?: boolean;
|
|
908
|
+
}
|
|
909
|
+
declare const OpenApiOperation: Schema.Struct<{
|
|
910
|
+
operationId: typeof Schema.String;
|
|
911
|
+
summary: Schema.optional<typeof Schema.String>;
|
|
912
|
+
description: Schema.optional<typeof Schema.String>;
|
|
913
|
+
deprecated: Schema.optional<typeof Schema.Boolean>;
|
|
914
|
+
parameters: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
915
|
+
name: typeof Schema.String;
|
|
916
|
+
in: Schema.Literal<["path", "query", "header", "cookie"]>;
|
|
917
|
+
description: Schema.optional<typeof Schema.String>;
|
|
918
|
+
required: typeof Schema.Boolean;
|
|
919
|
+
schema: Schema.Schema<OpenApiSchema, OpenApiSchema, never>;
|
|
920
|
+
}>>>;
|
|
921
|
+
requestBody: Schema.optional<Schema.Struct<{
|
|
922
|
+
description: Schema.optional<typeof Schema.String>;
|
|
923
|
+
required: Schema.optional<typeof Schema.Boolean>;
|
|
924
|
+
content: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
925
|
+
schema: typeof Schema.Unknown;
|
|
926
|
+
}>>;
|
|
927
|
+
}>>;
|
|
928
|
+
responses: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
929
|
+
description: typeof Schema.String;
|
|
930
|
+
content: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
931
|
+
schema: typeof Schema.Unknown;
|
|
932
|
+
}>>>;
|
|
933
|
+
}>>;
|
|
934
|
+
tags: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
935
|
+
/** Per-operation security requirements */
|
|
936
|
+
security: Schema.optional<Schema.Array$<Schema.Record$<typeof Schema.String, Schema.Array$<typeof Schema.String>>>>;
|
|
937
|
+
}>;
|
|
938
|
+
type OpenApiOperation = typeof OpenApiOperation.Type;
|
|
939
|
+
/** Maps path -> method -> operation */
|
|
940
|
+
interface OpenApiPaths {
|
|
941
|
+
readonly [path: string]: {
|
|
942
|
+
readonly [method: string]: OpenApiOperation;
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
declare const OpenApiGeneratorConfig: Schema.Struct<{
|
|
946
|
+
extends: Schema.optional<typeof Schema.String>;
|
|
947
|
+
files: Schema.optional<Schema.Struct<{
|
|
948
|
+
entry: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.String>]>>;
|
|
949
|
+
tsconfig: Schema.optional<typeof Schema.String>;
|
|
950
|
+
dtoGlob: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.String>]>>;
|
|
951
|
+
include: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
952
|
+
exclude: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
953
|
+
}>>;
|
|
954
|
+
output: typeof Schema.String;
|
|
955
|
+
format: Schema.optional<Schema.Literal<["json", "yaml"]>>;
|
|
956
|
+
openapi: Schema.Struct<{
|
|
957
|
+
version: Schema.optional<Schema.Literal<["3.0.3", "3.1.0", "3.2.0"]>>;
|
|
958
|
+
info: Schema.Struct<{
|
|
959
|
+
title: typeof Schema.String;
|
|
960
|
+
version: typeof Schema.String;
|
|
961
|
+
description: Schema.optional<typeof Schema.String>;
|
|
962
|
+
contact: Schema.optional<Schema.Struct<{
|
|
963
|
+
name: Schema.optional<typeof Schema.String>;
|
|
964
|
+
email: Schema.optional<typeof Schema.String>;
|
|
965
|
+
url: Schema.optional<typeof Schema.String>;
|
|
966
|
+
}>>;
|
|
967
|
+
license: Schema.optional<Schema.Struct<{
|
|
968
|
+
name: typeof Schema.String;
|
|
969
|
+
url: Schema.optional<typeof Schema.String>;
|
|
970
|
+
}>>;
|
|
971
|
+
}>;
|
|
972
|
+
servers: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
973
|
+
url: typeof Schema.String;
|
|
974
|
+
description: Schema.optional<typeof Schema.String>;
|
|
975
|
+
}>>>;
|
|
976
|
+
tags: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
977
|
+
name: typeof Schema.String;
|
|
978
|
+
description: Schema.optional<typeof Schema.String>;
|
|
979
|
+
}>>>;
|
|
980
|
+
security: Schema.optional<Schema.Struct<{
|
|
981
|
+
schemes: Schema.optional<Schema.Array$<Schema.Union<[Schema.Struct<{
|
|
982
|
+
name: typeof Schema.String;
|
|
983
|
+
type: Schema.Literal<["http"]>;
|
|
984
|
+
scheme: typeof Schema.String;
|
|
985
|
+
bearerFormat: Schema.optional<typeof Schema.String>;
|
|
986
|
+
description: Schema.optional<typeof Schema.String>;
|
|
987
|
+
}>, Schema.Struct<{
|
|
988
|
+
name: typeof Schema.String;
|
|
989
|
+
type: Schema.Literal<["apiKey"]>;
|
|
990
|
+
in: Schema.Literal<["query", "header", "cookie"]>;
|
|
991
|
+
parameterName: typeof Schema.String;
|
|
992
|
+
description: Schema.optional<typeof Schema.String>;
|
|
993
|
+
}>, Schema.Struct<{
|
|
994
|
+
name: typeof Schema.String;
|
|
995
|
+
type: Schema.Literal<["oauth2"]>;
|
|
996
|
+
flows: Schema.Struct<{
|
|
997
|
+
implicit: Schema.optional<Schema.Struct<{
|
|
998
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
999
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1000
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1001
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1002
|
+
}>>;
|
|
1003
|
+
password: Schema.optional<Schema.Struct<{
|
|
1004
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
1005
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1006
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1007
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1008
|
+
}>>;
|
|
1009
|
+
clientCredentials: Schema.optional<Schema.Struct<{
|
|
1010
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
1011
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1012
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1013
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1014
|
+
}>>;
|
|
1015
|
+
authorizationCode: Schema.optional<Schema.Struct<{
|
|
1016
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
1017
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1018
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1019
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1020
|
+
}>>;
|
|
1021
|
+
}>;
|
|
1022
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1023
|
+
}>, Schema.Struct<{
|
|
1024
|
+
name: typeof Schema.String;
|
|
1025
|
+
type: Schema.Literal<["openIdConnect"]>;
|
|
1026
|
+
openIdConnectUrl: typeof Schema.String;
|
|
1027
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1028
|
+
}>]>>>;
|
|
1029
|
+
global: Schema.optional<Schema.Array$<Schema.Record$<typeof Schema.String, Schema.Array$<typeof Schema.String>>>>;
|
|
1030
|
+
}>>;
|
|
1031
|
+
}>;
|
|
1032
|
+
options: Schema.optional<Schema.Struct<{
|
|
1033
|
+
basePath: Schema.optional<typeof Schema.String>;
|
|
1034
|
+
extractValidation: Schema.optional<typeof Schema.Boolean>;
|
|
1035
|
+
excludeDecorators: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
1036
|
+
query: Schema.optional<Schema.Struct<{
|
|
1037
|
+
style: Schema.optional<Schema.Literal<["inline", "ref"]>>;
|
|
1038
|
+
}>>;
|
|
1039
|
+
schemas: Schema.optional<Schema.Struct<{
|
|
1040
|
+
aliasRefs: Schema.optional<Schema.Literal<["collapse", "preserve"]>>;
|
|
1041
|
+
}>>;
|
|
1042
|
+
pathFilter: Schema.optional<Schema.Union<[Schema.instanceOf<RegExp>, Schema.declare<(path: string) => boolean, (path: string) => boolean, readonly [], never>]>>;
|
|
1043
|
+
}>>;
|
|
1044
|
+
}>;
|
|
1045
|
+
type OpenApiGeneratorConfig = typeof OpenApiGeneratorConfig.Type;
|
|
1046
|
+
declare const ResolvedConfig: Schema.Struct<{
|
|
1047
|
+
tsconfig: typeof Schema.String;
|
|
1048
|
+
entry: Schema.Array$<typeof Schema.String>;
|
|
1049
|
+
include: Schema.Array$<typeof Schema.String>;
|
|
1050
|
+
exclude: Schema.Array$<typeof Schema.String>;
|
|
1051
|
+
excludeDecorators: Schema.Array$<typeof Schema.String>;
|
|
1052
|
+
dtoGlob: Schema.Array$<typeof Schema.String>;
|
|
1053
|
+
extractValidation: typeof Schema.Boolean;
|
|
1054
|
+
aliasRefs: Schema.Literal<["collapse", "preserve"]>;
|
|
1055
|
+
basePath: Schema.optional<typeof Schema.String>;
|
|
1056
|
+
pathFilter: Schema.optional<Schema.Union<[Schema.instanceOf<RegExp>, Schema.declare<(path: string) => boolean, (path: string) => boolean, readonly [], never>]>>;
|
|
1057
|
+
version: Schema.optional<typeof Schema.String>;
|
|
1058
|
+
info: Schema.Struct<{
|
|
1059
|
+
title: typeof Schema.String;
|
|
1060
|
+
version: typeof Schema.String;
|
|
1061
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1062
|
+
contact: Schema.optional<Schema.Struct<{
|
|
1063
|
+
name: Schema.optional<typeof Schema.String>;
|
|
1064
|
+
email: Schema.optional<typeof Schema.String>;
|
|
1065
|
+
url: Schema.optional<typeof Schema.String>;
|
|
1066
|
+
}>>;
|
|
1067
|
+
license: Schema.optional<Schema.Struct<{
|
|
1068
|
+
name: typeof Schema.String;
|
|
1069
|
+
url: Schema.optional<typeof Schema.String>;
|
|
1070
|
+
}>>;
|
|
1071
|
+
}>;
|
|
1072
|
+
servers: Schema.Array$<Schema.Struct<{
|
|
1073
|
+
url: typeof Schema.String;
|
|
1074
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1075
|
+
}>>;
|
|
1076
|
+
securitySchemes: Schema.Array$<Schema.Union<[Schema.Struct<{
|
|
1077
|
+
name: typeof Schema.String;
|
|
1078
|
+
type: Schema.Literal<["http"]>;
|
|
1079
|
+
scheme: typeof Schema.String;
|
|
1080
|
+
bearerFormat: Schema.optional<typeof Schema.String>;
|
|
1081
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1082
|
+
}>, Schema.Struct<{
|
|
1083
|
+
name: typeof Schema.String;
|
|
1084
|
+
type: Schema.Literal<["apiKey"]>;
|
|
1085
|
+
in: Schema.Literal<["query", "header", "cookie"]>;
|
|
1086
|
+
parameterName: typeof Schema.String;
|
|
1087
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1088
|
+
}>, Schema.Struct<{
|
|
1089
|
+
name: typeof Schema.String;
|
|
1090
|
+
type: Schema.Literal<["oauth2"]>;
|
|
1091
|
+
flows: Schema.Struct<{
|
|
1092
|
+
implicit: Schema.optional<Schema.Struct<{
|
|
1093
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
1094
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1095
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1096
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1097
|
+
}>>;
|
|
1098
|
+
password: Schema.optional<Schema.Struct<{
|
|
1099
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
1100
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1101
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1102
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1103
|
+
}>>;
|
|
1104
|
+
clientCredentials: Schema.optional<Schema.Struct<{
|
|
1105
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
1106
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1107
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1108
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1109
|
+
}>>;
|
|
1110
|
+
authorizationCode: Schema.optional<Schema.Struct<{
|
|
1111
|
+
authorizationUrl: Schema.optional<typeof Schema.String>;
|
|
1112
|
+
tokenUrl: Schema.optional<typeof Schema.String>;
|
|
1113
|
+
refreshUrl: Schema.optional<typeof Schema.String>;
|
|
1114
|
+
scopes: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1115
|
+
}>>;
|
|
1116
|
+
}>;
|
|
1117
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1118
|
+
}>, Schema.Struct<{
|
|
1119
|
+
name: typeof Schema.String;
|
|
1120
|
+
type: Schema.Literal<["openIdConnect"]>;
|
|
1121
|
+
openIdConnectUrl: typeof Schema.String;
|
|
1122
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1123
|
+
}>]>>;
|
|
1124
|
+
securityRequirements: Schema.Array$<Schema.Record$<typeof Schema.String, Schema.Array$<typeof Schema.String>>>;
|
|
1125
|
+
tags: Schema.Array$<Schema.Struct<{
|
|
1126
|
+
name: typeof Schema.String;
|
|
1127
|
+
description: Schema.optional<typeof Schema.String>;
|
|
1128
|
+
}>>;
|
|
1129
|
+
output: typeof Schema.String;
|
|
1130
|
+
format: Schema.Literal<["json", "yaml"]>;
|
|
1131
|
+
}>;
|
|
1132
|
+
type ResolvedConfig = typeof ResolvedConfig.Type;
|
|
1133
|
+
|
|
1134
|
+
/** Configuration options for parameter extraction */
|
|
1135
|
+
interface ExtractParametersOptions {
|
|
1136
|
+
/** Query parameter handling options */
|
|
1137
|
+
readonly query?: {
|
|
1138
|
+
/** How to represent query DTOs: "inline" (default) or "ref" */
|
|
1139
|
+
readonly style?: 'inline' | 'ref';
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
declare const getMethodInfo: (controller: ClassDeclaration, method: MethodDeclaration, options?: ExtractParametersOptions) => Option.Option<MethodInfo>;
|
|
1143
|
+
declare const getMethodInfoEffect: (controller: ClassDeclaration, method: MethodDeclaration, options?: ExtractParametersOptions | undefined) => Effect.Effect<Option.Option<{
|
|
1144
|
+
readonly security: readonly {
|
|
1145
|
+
readonly scopes: readonly string[];
|
|
1146
|
+
readonly schemeName: string;
|
|
1147
|
+
}[];
|
|
1148
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1149
|
+
readonly path: string;
|
|
1150
|
+
readonly methodName: string;
|
|
1151
|
+
readonly controllerName: string;
|
|
1152
|
+
readonly controllerTags: readonly string[];
|
|
1153
|
+
readonly returnType: {
|
|
1154
|
+
readonly type: Option.Option<string>;
|
|
1155
|
+
readonly inline: Option.Option<string>;
|
|
1156
|
+
readonly container: Option.Option<"array">;
|
|
1157
|
+
readonly filePath: Option.Option<string>;
|
|
1158
|
+
};
|
|
1159
|
+
readonly parameters: readonly {
|
|
1160
|
+
readonly name: string;
|
|
1161
|
+
readonly description: Option.Option<string>;
|
|
1162
|
+
readonly location: "query" | "header" | "cookie" | "path" | "body";
|
|
1163
|
+
readonly tsType: string;
|
|
1164
|
+
readonly required: boolean;
|
|
1165
|
+
}[];
|
|
1166
|
+
readonly decorators: readonly string[];
|
|
1167
|
+
readonly operation: {
|
|
1168
|
+
readonly description: Option.Option<string>;
|
|
1169
|
+
readonly summary: Option.Option<string>;
|
|
1170
|
+
readonly operationId: Option.Option<string>;
|
|
1171
|
+
readonly deprecated: Option.Option<boolean>;
|
|
1172
|
+
};
|
|
1173
|
+
readonly responses: readonly {
|
|
1174
|
+
readonly description: Option.Option<string>;
|
|
1175
|
+
readonly type: Option.Option<string>;
|
|
1176
|
+
readonly statusCode: number;
|
|
1177
|
+
readonly isArray: boolean;
|
|
1178
|
+
}[];
|
|
1179
|
+
readonly httpCode: Option.Option<number>;
|
|
1180
|
+
readonly consumes: readonly string[];
|
|
1181
|
+
readonly produces: readonly string[];
|
|
1182
|
+
}>, never, never>;
|
|
1183
|
+
declare const getControllerMethodInfos: (controller: ClassDeclaration, options?: ExtractParametersOptions) => readonly MethodInfo[];
|
|
1184
|
+
declare const getControllerMethodInfosEffect: (controller: ClassDeclaration, options?: ExtractParametersOptions | undefined) => Effect.Effect<{
|
|
1185
|
+
readonly security: readonly {
|
|
1186
|
+
readonly scopes: readonly string[];
|
|
1187
|
+
readonly schemeName: string;
|
|
1188
|
+
}[];
|
|
1189
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1190
|
+
readonly path: string;
|
|
1191
|
+
readonly methodName: string;
|
|
1192
|
+
readonly controllerName: string;
|
|
1193
|
+
readonly controllerTags: readonly string[];
|
|
1194
|
+
readonly returnType: {
|
|
1195
|
+
readonly type: Option.Option<string>;
|
|
1196
|
+
readonly inline: Option.Option<string>;
|
|
1197
|
+
readonly container: Option.Option<"array">;
|
|
1198
|
+
readonly filePath: Option.Option<string>;
|
|
1199
|
+
};
|
|
1200
|
+
readonly parameters: readonly {
|
|
1201
|
+
readonly name: string;
|
|
1202
|
+
readonly description: Option.Option<string>;
|
|
1203
|
+
readonly location: "query" | "header" | "cookie" | "path" | "body";
|
|
1204
|
+
readonly tsType: string;
|
|
1205
|
+
readonly required: boolean;
|
|
1206
|
+
}[];
|
|
1207
|
+
readonly decorators: readonly string[];
|
|
1208
|
+
readonly operation: {
|
|
1209
|
+
readonly description: Option.Option<string>;
|
|
1210
|
+
readonly summary: Option.Option<string>;
|
|
1211
|
+
readonly operationId: Option.Option<string>;
|
|
1212
|
+
readonly deprecated: Option.Option<boolean>;
|
|
1213
|
+
};
|
|
1214
|
+
readonly responses: readonly {
|
|
1215
|
+
readonly description: Option.Option<string>;
|
|
1216
|
+
readonly type: Option.Option<string>;
|
|
1217
|
+
readonly statusCode: number;
|
|
1218
|
+
readonly isArray: boolean;
|
|
1219
|
+
}[];
|
|
1220
|
+
readonly httpCode: Option.Option<number>;
|
|
1221
|
+
readonly consumes: readonly string[];
|
|
1222
|
+
readonly produces: readonly string[];
|
|
1223
|
+
}[], never, never>;
|
|
1224
|
+
declare const MethodExtractionService_base: Effect.Service.Class<MethodExtractionService, "MethodExtractionService", {
|
|
1225
|
+
readonly accessors: true;
|
|
1226
|
+
readonly effect: Effect.Effect<{
|
|
1227
|
+
getMethodInfo: (controller: ClassDeclaration, method: MethodDeclaration, options?: ExtractParametersOptions | undefined) => Effect.Effect<Option.Option<{
|
|
1228
|
+
readonly security: readonly {
|
|
1229
|
+
readonly scopes: readonly string[];
|
|
1230
|
+
readonly schemeName: string;
|
|
1231
|
+
}[];
|
|
1232
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1233
|
+
readonly path: string;
|
|
1234
|
+
readonly methodName: string;
|
|
1235
|
+
readonly controllerName: string;
|
|
1236
|
+
readonly controllerTags: readonly string[];
|
|
1237
|
+
readonly returnType: {
|
|
1238
|
+
readonly type: Option.Option<string>;
|
|
1239
|
+
readonly inline: Option.Option<string>;
|
|
1240
|
+
readonly container: Option.Option<"array">;
|
|
1241
|
+
readonly filePath: Option.Option<string>;
|
|
1242
|
+
};
|
|
1243
|
+
readonly parameters: readonly {
|
|
1244
|
+
readonly name: string;
|
|
1245
|
+
readonly description: Option.Option<string>;
|
|
1246
|
+
readonly location: "query" | "header" | "cookie" | "path" | "body";
|
|
1247
|
+
readonly tsType: string;
|
|
1248
|
+
readonly required: boolean;
|
|
1249
|
+
}[];
|
|
1250
|
+
readonly decorators: readonly string[];
|
|
1251
|
+
readonly operation: {
|
|
1252
|
+
readonly description: Option.Option<string>;
|
|
1253
|
+
readonly summary: Option.Option<string>;
|
|
1254
|
+
readonly operationId: Option.Option<string>;
|
|
1255
|
+
readonly deprecated: Option.Option<boolean>;
|
|
1256
|
+
};
|
|
1257
|
+
readonly responses: readonly {
|
|
1258
|
+
readonly description: Option.Option<string>;
|
|
1259
|
+
readonly type: Option.Option<string>;
|
|
1260
|
+
readonly statusCode: number;
|
|
1261
|
+
readonly isArray: boolean;
|
|
1262
|
+
}[];
|
|
1263
|
+
readonly httpCode: Option.Option<number>;
|
|
1264
|
+
readonly consumes: readonly string[];
|
|
1265
|
+
readonly produces: readonly string[];
|
|
1266
|
+
}>, never, never>;
|
|
1267
|
+
getControllerMethodInfos: (controller: ClassDeclaration, options?: ExtractParametersOptions | undefined) => Effect.Effect<{
|
|
1268
|
+
readonly security: readonly {
|
|
1269
|
+
readonly scopes: readonly string[];
|
|
1270
|
+
readonly schemeName: string;
|
|
1271
|
+
}[];
|
|
1272
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1273
|
+
readonly path: string;
|
|
1274
|
+
readonly methodName: string;
|
|
1275
|
+
readonly controllerName: string;
|
|
1276
|
+
readonly controllerTags: readonly string[];
|
|
1277
|
+
readonly returnType: {
|
|
1278
|
+
readonly type: Option.Option<string>;
|
|
1279
|
+
readonly inline: Option.Option<string>;
|
|
1280
|
+
readonly container: Option.Option<"array">;
|
|
1281
|
+
readonly filePath: Option.Option<string>;
|
|
1282
|
+
};
|
|
1283
|
+
readonly parameters: readonly {
|
|
1284
|
+
readonly name: string;
|
|
1285
|
+
readonly description: Option.Option<string>;
|
|
1286
|
+
readonly location: "query" | "header" | "cookie" | "path" | "body";
|
|
1287
|
+
readonly tsType: string;
|
|
1288
|
+
readonly required: boolean;
|
|
1289
|
+
}[];
|
|
1290
|
+
readonly decorators: readonly string[];
|
|
1291
|
+
readonly operation: {
|
|
1292
|
+
readonly description: Option.Option<string>;
|
|
1293
|
+
readonly summary: Option.Option<string>;
|
|
1294
|
+
readonly operationId: Option.Option<string>;
|
|
1295
|
+
readonly deprecated: Option.Option<boolean>;
|
|
1296
|
+
};
|
|
1297
|
+
readonly responses: readonly {
|
|
1298
|
+
readonly description: Option.Option<string>;
|
|
1299
|
+
readonly type: Option.Option<string>;
|
|
1300
|
+
readonly statusCode: number;
|
|
1301
|
+
readonly isArray: boolean;
|
|
1302
|
+
}[];
|
|
1303
|
+
readonly httpCode: Option.Option<number>;
|
|
1304
|
+
readonly consumes: readonly string[];
|
|
1305
|
+
readonly produces: readonly string[];
|
|
1306
|
+
}[], never, never>;
|
|
1307
|
+
}, never, never>;
|
|
1308
|
+
}>;
|
|
1309
|
+
declare class MethodExtractionService extends MethodExtractionService_base {
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Define configuration for OpenAPI generation.
|
|
1314
|
+
*
|
|
1315
|
+
* @example
|
|
1316
|
+
* ```typescript
|
|
1317
|
+
* export default defineConfig({
|
|
1318
|
+
* output: 'openapi.json',
|
|
1319
|
+
* files: { entry: 'src/app.module.ts' },
|
|
1320
|
+
* openapi: { info: { title: 'My API', version: '1.0.0' } },
|
|
1321
|
+
* });
|
|
1322
|
+
* ```
|
|
1323
|
+
*/
|
|
1324
|
+
declare function defineConfig(config: Config): Config;
|
|
1325
|
+
declare const findConfigFile: (startDir?: string) => Effect.Effect<string, ConfigNotFoundError>;
|
|
1326
|
+
declare const loadConfigFromFile: (configPath: string) => Effect.Effect<typeof OpenApiGeneratorConfig.Type, ConfigError>;
|
|
1327
|
+
declare const loadConfig: (configPath?: string, cwd?: string) => Effect.Effect<typeof OpenApiGeneratorConfig.Type, ConfigError>;
|
|
1328
|
+
declare const resolveConfig: (config: typeof OpenApiGeneratorConfig.Type, configPath?: string) => Effect.Effect<typeof ResolvedConfig.Type, ConfigValidationError>;
|
|
1329
|
+
declare const loadAndResolveConfig: (configPath?: string, cwd?: string) => Effect.Effect<typeof ResolvedConfig.Type, ConfigError>;
|
|
1330
|
+
declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigService", {
|
|
1331
|
+
readonly accessors: true;
|
|
1332
|
+
readonly effect: Effect.Effect<{
|
|
1333
|
+
findConfigFile: (startDir?: string | undefined) => Effect.Effect<string, ConfigNotFoundError, never>;
|
|
1334
|
+
loadConfigFromFile: (configPath: string) => Effect.Effect<{
|
|
1335
|
+
readonly extends?: string | undefined;
|
|
1336
|
+
readonly files?: {
|
|
1337
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1338
|
+
readonly tsconfig?: string | undefined;
|
|
1339
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1340
|
+
readonly include?: readonly string[] | undefined;
|
|
1341
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1342
|
+
} | undefined;
|
|
1343
|
+
readonly output: string;
|
|
1344
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1345
|
+
readonly openapi: {
|
|
1346
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1347
|
+
readonly info: {
|
|
1348
|
+
readonly version: string;
|
|
1349
|
+
readonly title: string;
|
|
1350
|
+
readonly description?: string | undefined;
|
|
1351
|
+
readonly contact?: {
|
|
1352
|
+
readonly name?: string | undefined;
|
|
1353
|
+
readonly email?: string | undefined;
|
|
1354
|
+
readonly url?: string | undefined;
|
|
1355
|
+
} | undefined;
|
|
1356
|
+
readonly license?: {
|
|
1357
|
+
readonly name: string;
|
|
1358
|
+
readonly url?: string | undefined;
|
|
1359
|
+
} | undefined;
|
|
1360
|
+
};
|
|
1361
|
+
readonly servers?: readonly {
|
|
1362
|
+
readonly description?: string | undefined;
|
|
1363
|
+
readonly url: string;
|
|
1364
|
+
}[] | undefined;
|
|
1365
|
+
readonly tags?: readonly {
|
|
1366
|
+
readonly name: string;
|
|
1367
|
+
readonly description?: string | undefined;
|
|
1368
|
+
}[] | undefined;
|
|
1369
|
+
readonly security?: {
|
|
1370
|
+
readonly schemes?: readonly ({
|
|
1371
|
+
readonly name: string;
|
|
1372
|
+
readonly description?: string | undefined;
|
|
1373
|
+
readonly type: "http";
|
|
1374
|
+
readonly scheme: string;
|
|
1375
|
+
readonly bearerFormat?: string | undefined;
|
|
1376
|
+
} | {
|
|
1377
|
+
readonly name: string;
|
|
1378
|
+
readonly description?: string | undefined;
|
|
1379
|
+
readonly type: "apiKey";
|
|
1380
|
+
readonly in: "query" | "header" | "cookie";
|
|
1381
|
+
readonly parameterName: string;
|
|
1382
|
+
} | {
|
|
1383
|
+
readonly name: string;
|
|
1384
|
+
readonly description?: string | undefined;
|
|
1385
|
+
readonly type: "oauth2";
|
|
1386
|
+
readonly flows: {
|
|
1387
|
+
readonly implicit?: {
|
|
1388
|
+
readonly authorizationUrl?: string | undefined;
|
|
1389
|
+
readonly tokenUrl?: string | undefined;
|
|
1390
|
+
readonly refreshUrl?: string | undefined;
|
|
1391
|
+
readonly scopes?: {
|
|
1392
|
+
readonly [x: string]: string;
|
|
1393
|
+
} | undefined;
|
|
1394
|
+
} | undefined;
|
|
1395
|
+
readonly password?: {
|
|
1396
|
+
readonly authorizationUrl?: string | undefined;
|
|
1397
|
+
readonly tokenUrl?: string | undefined;
|
|
1398
|
+
readonly refreshUrl?: string | undefined;
|
|
1399
|
+
readonly scopes?: {
|
|
1400
|
+
readonly [x: string]: string;
|
|
1401
|
+
} | undefined;
|
|
1402
|
+
} | undefined;
|
|
1403
|
+
readonly clientCredentials?: {
|
|
1404
|
+
readonly authorizationUrl?: string | undefined;
|
|
1405
|
+
readonly tokenUrl?: string | undefined;
|
|
1406
|
+
readonly refreshUrl?: string | undefined;
|
|
1407
|
+
readonly scopes?: {
|
|
1408
|
+
readonly [x: string]: string;
|
|
1409
|
+
} | undefined;
|
|
1410
|
+
} | undefined;
|
|
1411
|
+
readonly authorizationCode?: {
|
|
1412
|
+
readonly authorizationUrl?: string | undefined;
|
|
1413
|
+
readonly tokenUrl?: string | undefined;
|
|
1414
|
+
readonly refreshUrl?: string | undefined;
|
|
1415
|
+
readonly scopes?: {
|
|
1416
|
+
readonly [x: string]: string;
|
|
1417
|
+
} | undefined;
|
|
1418
|
+
} | undefined;
|
|
1419
|
+
};
|
|
1420
|
+
} | {
|
|
1421
|
+
readonly name: string;
|
|
1422
|
+
readonly description?: string | undefined;
|
|
1423
|
+
readonly type: "openIdConnect";
|
|
1424
|
+
readonly openIdConnectUrl: string;
|
|
1425
|
+
})[] | undefined;
|
|
1426
|
+
readonly global?: readonly {
|
|
1427
|
+
readonly [x: string]: readonly string[];
|
|
1428
|
+
}[] | undefined;
|
|
1429
|
+
} | undefined;
|
|
1430
|
+
};
|
|
1431
|
+
readonly options?: {
|
|
1432
|
+
readonly query?: {
|
|
1433
|
+
readonly style?: "inline" | "ref" | undefined;
|
|
1434
|
+
} | undefined;
|
|
1435
|
+
readonly basePath?: string | undefined;
|
|
1436
|
+
readonly extractValidation?: boolean | undefined;
|
|
1437
|
+
readonly excludeDecorators?: readonly string[] | undefined;
|
|
1438
|
+
readonly schemas?: {
|
|
1439
|
+
readonly aliasRefs?: "collapse" | "preserve" | undefined;
|
|
1440
|
+
} | undefined;
|
|
1441
|
+
readonly pathFilter?: RegExp | ((path: string) => boolean) | undefined;
|
|
1442
|
+
} | undefined;
|
|
1443
|
+
}, ConfigError, never>;
|
|
1444
|
+
loadConfig: (configPath?: string | undefined, cwd?: string | undefined) => Effect.Effect<{
|
|
1445
|
+
readonly extends?: string | undefined;
|
|
1446
|
+
readonly files?: {
|
|
1447
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1448
|
+
readonly tsconfig?: string | undefined;
|
|
1449
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1450
|
+
readonly include?: readonly string[] | undefined;
|
|
1451
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1452
|
+
} | undefined;
|
|
1453
|
+
readonly output: string;
|
|
1454
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1455
|
+
readonly openapi: {
|
|
1456
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1457
|
+
readonly info: {
|
|
1458
|
+
readonly version: string;
|
|
1459
|
+
readonly title: string;
|
|
1460
|
+
readonly description?: string | undefined;
|
|
1461
|
+
readonly contact?: {
|
|
1462
|
+
readonly name?: string | undefined;
|
|
1463
|
+
readonly email?: string | undefined;
|
|
1464
|
+
readonly url?: string | undefined;
|
|
1465
|
+
} | undefined;
|
|
1466
|
+
readonly license?: {
|
|
1467
|
+
readonly name: string;
|
|
1468
|
+
readonly url?: string | undefined;
|
|
1469
|
+
} | undefined;
|
|
1470
|
+
};
|
|
1471
|
+
readonly servers?: readonly {
|
|
1472
|
+
readonly description?: string | undefined;
|
|
1473
|
+
readonly url: string;
|
|
1474
|
+
}[] | undefined;
|
|
1475
|
+
readonly tags?: readonly {
|
|
1476
|
+
readonly name: string;
|
|
1477
|
+
readonly description?: string | undefined;
|
|
1478
|
+
}[] | undefined;
|
|
1479
|
+
readonly security?: {
|
|
1480
|
+
readonly schemes?: readonly ({
|
|
1481
|
+
readonly name: string;
|
|
1482
|
+
readonly description?: string | undefined;
|
|
1483
|
+
readonly type: "http";
|
|
1484
|
+
readonly scheme: string;
|
|
1485
|
+
readonly bearerFormat?: string | undefined;
|
|
1486
|
+
} | {
|
|
1487
|
+
readonly name: string;
|
|
1488
|
+
readonly description?: string | undefined;
|
|
1489
|
+
readonly type: "apiKey";
|
|
1490
|
+
readonly in: "query" | "header" | "cookie";
|
|
1491
|
+
readonly parameterName: string;
|
|
1492
|
+
} | {
|
|
1493
|
+
readonly name: string;
|
|
1494
|
+
readonly description?: string | undefined;
|
|
1495
|
+
readonly type: "oauth2";
|
|
1496
|
+
readonly flows: {
|
|
1497
|
+
readonly implicit?: {
|
|
1498
|
+
readonly authorizationUrl?: string | undefined;
|
|
1499
|
+
readonly tokenUrl?: string | undefined;
|
|
1500
|
+
readonly refreshUrl?: string | undefined;
|
|
1501
|
+
readonly scopes?: {
|
|
1502
|
+
readonly [x: string]: string;
|
|
1503
|
+
} | undefined;
|
|
1504
|
+
} | undefined;
|
|
1505
|
+
readonly password?: {
|
|
1506
|
+
readonly authorizationUrl?: string | undefined;
|
|
1507
|
+
readonly tokenUrl?: string | undefined;
|
|
1508
|
+
readonly refreshUrl?: string | undefined;
|
|
1509
|
+
readonly scopes?: {
|
|
1510
|
+
readonly [x: string]: string;
|
|
1511
|
+
} | undefined;
|
|
1512
|
+
} | undefined;
|
|
1513
|
+
readonly clientCredentials?: {
|
|
1514
|
+
readonly authorizationUrl?: string | undefined;
|
|
1515
|
+
readonly tokenUrl?: string | undefined;
|
|
1516
|
+
readonly refreshUrl?: string | undefined;
|
|
1517
|
+
readonly scopes?: {
|
|
1518
|
+
readonly [x: string]: string;
|
|
1519
|
+
} | undefined;
|
|
1520
|
+
} | undefined;
|
|
1521
|
+
readonly authorizationCode?: {
|
|
1522
|
+
readonly authorizationUrl?: string | undefined;
|
|
1523
|
+
readonly tokenUrl?: string | undefined;
|
|
1524
|
+
readonly refreshUrl?: string | undefined;
|
|
1525
|
+
readonly scopes?: {
|
|
1526
|
+
readonly [x: string]: string;
|
|
1527
|
+
} | undefined;
|
|
1528
|
+
} | undefined;
|
|
1529
|
+
};
|
|
1530
|
+
} | {
|
|
1531
|
+
readonly name: string;
|
|
1532
|
+
readonly description?: string | undefined;
|
|
1533
|
+
readonly type: "openIdConnect";
|
|
1534
|
+
readonly openIdConnectUrl: string;
|
|
1535
|
+
})[] | undefined;
|
|
1536
|
+
readonly global?: readonly {
|
|
1537
|
+
readonly [x: string]: readonly string[];
|
|
1538
|
+
}[] | undefined;
|
|
1539
|
+
} | undefined;
|
|
1540
|
+
};
|
|
1541
|
+
readonly options?: {
|
|
1542
|
+
readonly query?: {
|
|
1543
|
+
readonly style?: "inline" | "ref" | undefined;
|
|
1544
|
+
} | undefined;
|
|
1545
|
+
readonly basePath?: string | undefined;
|
|
1546
|
+
readonly extractValidation?: boolean | undefined;
|
|
1547
|
+
readonly excludeDecorators?: readonly string[] | undefined;
|
|
1548
|
+
readonly schemas?: {
|
|
1549
|
+
readonly aliasRefs?: "collapse" | "preserve" | undefined;
|
|
1550
|
+
} | undefined;
|
|
1551
|
+
readonly pathFilter?: RegExp | ((path: string) => boolean) | undefined;
|
|
1552
|
+
} | undefined;
|
|
1553
|
+
}, ConfigError, never>;
|
|
1554
|
+
resolveConfig: (config: {
|
|
1555
|
+
readonly extends?: string | undefined;
|
|
1556
|
+
readonly files?: {
|
|
1557
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1558
|
+
readonly tsconfig?: string | undefined;
|
|
1559
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1560
|
+
readonly include?: readonly string[] | undefined;
|
|
1561
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1562
|
+
} | undefined;
|
|
1563
|
+
readonly output: string;
|
|
1564
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1565
|
+
readonly openapi: {
|
|
1566
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1567
|
+
readonly info: {
|
|
1568
|
+
readonly version: string;
|
|
1569
|
+
readonly title: string;
|
|
1570
|
+
readonly description?: string | undefined;
|
|
1571
|
+
readonly contact?: {
|
|
1572
|
+
readonly name?: string | undefined;
|
|
1573
|
+
readonly email?: string | undefined;
|
|
1574
|
+
readonly url?: string | undefined;
|
|
1575
|
+
} | undefined;
|
|
1576
|
+
readonly license?: {
|
|
1577
|
+
readonly name: string;
|
|
1578
|
+
readonly url?: string | undefined;
|
|
1579
|
+
} | undefined;
|
|
1580
|
+
};
|
|
1581
|
+
readonly servers?: readonly {
|
|
1582
|
+
readonly description?: string | undefined;
|
|
1583
|
+
readonly url: string;
|
|
1584
|
+
}[] | undefined;
|
|
1585
|
+
readonly tags?: readonly {
|
|
1586
|
+
readonly name: string;
|
|
1587
|
+
readonly description?: string | undefined;
|
|
1588
|
+
}[] | undefined;
|
|
1589
|
+
readonly security?: {
|
|
1590
|
+
readonly schemes?: readonly ({
|
|
1591
|
+
readonly name: string;
|
|
1592
|
+
readonly description?: string | undefined;
|
|
1593
|
+
readonly type: "http";
|
|
1594
|
+
readonly scheme: string;
|
|
1595
|
+
readonly bearerFormat?: string | undefined;
|
|
1596
|
+
} | {
|
|
1597
|
+
readonly name: string;
|
|
1598
|
+
readonly description?: string | undefined;
|
|
1599
|
+
readonly type: "apiKey";
|
|
1600
|
+
readonly in: "query" | "header" | "cookie";
|
|
1601
|
+
readonly parameterName: string;
|
|
1602
|
+
} | {
|
|
1603
|
+
readonly name: string;
|
|
1604
|
+
readonly description?: string | undefined;
|
|
1605
|
+
readonly type: "oauth2";
|
|
1606
|
+
readonly flows: {
|
|
1607
|
+
readonly implicit?: {
|
|
1608
|
+
readonly authorizationUrl?: string | undefined;
|
|
1609
|
+
readonly tokenUrl?: string | undefined;
|
|
1610
|
+
readonly refreshUrl?: string | undefined;
|
|
1611
|
+
readonly scopes?: {
|
|
1612
|
+
readonly [x: string]: string;
|
|
1613
|
+
} | undefined;
|
|
1614
|
+
} | undefined;
|
|
1615
|
+
readonly password?: {
|
|
1616
|
+
readonly authorizationUrl?: string | undefined;
|
|
1617
|
+
readonly tokenUrl?: string | undefined;
|
|
1618
|
+
readonly refreshUrl?: string | undefined;
|
|
1619
|
+
readonly scopes?: {
|
|
1620
|
+
readonly [x: string]: string;
|
|
1621
|
+
} | undefined;
|
|
1622
|
+
} | undefined;
|
|
1623
|
+
readonly clientCredentials?: {
|
|
1624
|
+
readonly authorizationUrl?: string | undefined;
|
|
1625
|
+
readonly tokenUrl?: string | undefined;
|
|
1626
|
+
readonly refreshUrl?: string | undefined;
|
|
1627
|
+
readonly scopes?: {
|
|
1628
|
+
readonly [x: string]: string;
|
|
1629
|
+
} | undefined;
|
|
1630
|
+
} | undefined;
|
|
1631
|
+
readonly authorizationCode?: {
|
|
1632
|
+
readonly authorizationUrl?: string | undefined;
|
|
1633
|
+
readonly tokenUrl?: string | undefined;
|
|
1634
|
+
readonly refreshUrl?: string | undefined;
|
|
1635
|
+
readonly scopes?: {
|
|
1636
|
+
readonly [x: string]: string;
|
|
1637
|
+
} | undefined;
|
|
1638
|
+
} | undefined;
|
|
1639
|
+
};
|
|
1640
|
+
} | {
|
|
1641
|
+
readonly name: string;
|
|
1642
|
+
readonly description?: string | undefined;
|
|
1643
|
+
readonly type: "openIdConnect";
|
|
1644
|
+
readonly openIdConnectUrl: string;
|
|
1645
|
+
})[] | undefined;
|
|
1646
|
+
readonly global?: readonly {
|
|
1647
|
+
readonly [x: string]: readonly string[];
|
|
1648
|
+
}[] | undefined;
|
|
1649
|
+
} | undefined;
|
|
1650
|
+
};
|
|
1651
|
+
readonly options?: {
|
|
1652
|
+
readonly query?: {
|
|
1653
|
+
readonly style?: "inline" | "ref" | undefined;
|
|
1654
|
+
} | undefined;
|
|
1655
|
+
readonly basePath?: string | undefined;
|
|
1656
|
+
readonly extractValidation?: boolean | undefined;
|
|
1657
|
+
readonly excludeDecorators?: readonly string[] | undefined;
|
|
1658
|
+
readonly schemas?: {
|
|
1659
|
+
readonly aliasRefs?: "collapse" | "preserve" | undefined;
|
|
1660
|
+
} | undefined;
|
|
1661
|
+
readonly pathFilter?: RegExp | ((path: string) => boolean) | undefined;
|
|
1662
|
+
} | undefined;
|
|
1663
|
+
}, configPath?: string | undefined) => Effect.Effect<{
|
|
1664
|
+
readonly entry: readonly string[];
|
|
1665
|
+
readonly tsconfig: string;
|
|
1666
|
+
readonly dtoGlob: readonly string[];
|
|
1667
|
+
readonly include: readonly string[];
|
|
1668
|
+
readonly exclude: readonly string[];
|
|
1669
|
+
readonly output: string;
|
|
1670
|
+
readonly format: "json" | "yaml";
|
|
1671
|
+
readonly version?: string | undefined;
|
|
1672
|
+
readonly info: {
|
|
1673
|
+
readonly version: string;
|
|
1674
|
+
readonly title: string;
|
|
1675
|
+
readonly description?: string | undefined;
|
|
1676
|
+
readonly contact?: {
|
|
1677
|
+
readonly name?: string | undefined;
|
|
1678
|
+
readonly email?: string | undefined;
|
|
1679
|
+
readonly url?: string | undefined;
|
|
1680
|
+
} | undefined;
|
|
1681
|
+
readonly license?: {
|
|
1682
|
+
readonly name: string;
|
|
1683
|
+
readonly url?: string | undefined;
|
|
1684
|
+
} | undefined;
|
|
1685
|
+
};
|
|
1686
|
+
readonly servers: readonly {
|
|
1687
|
+
readonly description?: string | undefined;
|
|
1688
|
+
readonly url: string;
|
|
1689
|
+
}[];
|
|
1690
|
+
readonly tags: readonly {
|
|
1691
|
+
readonly name: string;
|
|
1692
|
+
readonly description?: string | undefined;
|
|
1693
|
+
}[];
|
|
1694
|
+
readonly basePath?: string | undefined;
|
|
1695
|
+
readonly extractValidation: boolean;
|
|
1696
|
+
readonly excludeDecorators: readonly string[];
|
|
1697
|
+
readonly aliasRefs: "collapse" | "preserve";
|
|
1698
|
+
readonly pathFilter?: RegExp | ((path: string) => boolean) | undefined;
|
|
1699
|
+
readonly securitySchemes: readonly ({
|
|
1700
|
+
readonly name: string;
|
|
1701
|
+
readonly description?: string | undefined;
|
|
1702
|
+
readonly type: "http";
|
|
1703
|
+
readonly scheme: string;
|
|
1704
|
+
readonly bearerFormat?: string | undefined;
|
|
1705
|
+
} | {
|
|
1706
|
+
readonly name: string;
|
|
1707
|
+
readonly description?: string | undefined;
|
|
1708
|
+
readonly type: "apiKey";
|
|
1709
|
+
readonly in: "query" | "header" | "cookie";
|
|
1710
|
+
readonly parameterName: string;
|
|
1711
|
+
} | {
|
|
1712
|
+
readonly name: string;
|
|
1713
|
+
readonly description?: string | undefined;
|
|
1714
|
+
readonly type: "oauth2";
|
|
1715
|
+
readonly flows: {
|
|
1716
|
+
readonly implicit?: {
|
|
1717
|
+
readonly authorizationUrl?: string | undefined;
|
|
1718
|
+
readonly tokenUrl?: string | undefined;
|
|
1719
|
+
readonly refreshUrl?: string | undefined;
|
|
1720
|
+
readonly scopes?: {
|
|
1721
|
+
readonly [x: string]: string;
|
|
1722
|
+
} | undefined;
|
|
1723
|
+
} | undefined;
|
|
1724
|
+
readonly password?: {
|
|
1725
|
+
readonly authorizationUrl?: string | undefined;
|
|
1726
|
+
readonly tokenUrl?: string | undefined;
|
|
1727
|
+
readonly refreshUrl?: string | undefined;
|
|
1728
|
+
readonly scopes?: {
|
|
1729
|
+
readonly [x: string]: string;
|
|
1730
|
+
} | undefined;
|
|
1731
|
+
} | undefined;
|
|
1732
|
+
readonly clientCredentials?: {
|
|
1733
|
+
readonly authorizationUrl?: string | undefined;
|
|
1734
|
+
readonly tokenUrl?: string | undefined;
|
|
1735
|
+
readonly refreshUrl?: string | undefined;
|
|
1736
|
+
readonly scopes?: {
|
|
1737
|
+
readonly [x: string]: string;
|
|
1738
|
+
} | undefined;
|
|
1739
|
+
} | undefined;
|
|
1740
|
+
readonly authorizationCode?: {
|
|
1741
|
+
readonly authorizationUrl?: string | undefined;
|
|
1742
|
+
readonly tokenUrl?: string | undefined;
|
|
1743
|
+
readonly refreshUrl?: string | undefined;
|
|
1744
|
+
readonly scopes?: {
|
|
1745
|
+
readonly [x: string]: string;
|
|
1746
|
+
} | undefined;
|
|
1747
|
+
} | undefined;
|
|
1748
|
+
};
|
|
1749
|
+
} | {
|
|
1750
|
+
readonly name: string;
|
|
1751
|
+
readonly description?: string | undefined;
|
|
1752
|
+
readonly type: "openIdConnect";
|
|
1753
|
+
readonly openIdConnectUrl: string;
|
|
1754
|
+
})[];
|
|
1755
|
+
readonly securityRequirements: readonly {
|
|
1756
|
+
readonly [x: string]: readonly string[];
|
|
1757
|
+
}[];
|
|
1758
|
+
}, ConfigValidationError, never>;
|
|
1759
|
+
loadAndResolveConfig: (configPath?: string | undefined, cwd?: string | undefined) => Effect.Effect<{
|
|
1760
|
+
readonly entry: readonly string[];
|
|
1761
|
+
readonly tsconfig: string;
|
|
1762
|
+
readonly dtoGlob: readonly string[];
|
|
1763
|
+
readonly include: readonly string[];
|
|
1764
|
+
readonly exclude: readonly string[];
|
|
1765
|
+
readonly output: string;
|
|
1766
|
+
readonly format: "json" | "yaml";
|
|
1767
|
+
readonly version?: string | undefined;
|
|
1768
|
+
readonly info: {
|
|
1769
|
+
readonly version: string;
|
|
1770
|
+
readonly title: string;
|
|
1771
|
+
readonly description?: string | undefined;
|
|
1772
|
+
readonly contact?: {
|
|
1773
|
+
readonly name?: string | undefined;
|
|
1774
|
+
readonly email?: string | undefined;
|
|
1775
|
+
readonly url?: string | undefined;
|
|
1776
|
+
} | undefined;
|
|
1777
|
+
readonly license?: {
|
|
1778
|
+
readonly name: string;
|
|
1779
|
+
readonly url?: string | undefined;
|
|
1780
|
+
} | undefined;
|
|
1781
|
+
};
|
|
1782
|
+
readonly servers: readonly {
|
|
1783
|
+
readonly description?: string | undefined;
|
|
1784
|
+
readonly url: string;
|
|
1785
|
+
}[];
|
|
1786
|
+
readonly tags: readonly {
|
|
1787
|
+
readonly name: string;
|
|
1788
|
+
readonly description?: string | undefined;
|
|
1789
|
+
}[];
|
|
1790
|
+
readonly basePath?: string | undefined;
|
|
1791
|
+
readonly extractValidation: boolean;
|
|
1792
|
+
readonly excludeDecorators: readonly string[];
|
|
1793
|
+
readonly aliasRefs: "collapse" | "preserve";
|
|
1794
|
+
readonly pathFilter?: RegExp | ((path: string) => boolean) | undefined;
|
|
1795
|
+
readonly securitySchemes: readonly ({
|
|
1796
|
+
readonly name: string;
|
|
1797
|
+
readonly description?: string | undefined;
|
|
1798
|
+
readonly type: "http";
|
|
1799
|
+
readonly scheme: string;
|
|
1800
|
+
readonly bearerFormat?: string | undefined;
|
|
1801
|
+
} | {
|
|
1802
|
+
readonly name: string;
|
|
1803
|
+
readonly description?: string | undefined;
|
|
1804
|
+
readonly type: "apiKey";
|
|
1805
|
+
readonly in: "query" | "header" | "cookie";
|
|
1806
|
+
readonly parameterName: string;
|
|
1807
|
+
} | {
|
|
1808
|
+
readonly name: string;
|
|
1809
|
+
readonly description?: string | undefined;
|
|
1810
|
+
readonly type: "oauth2";
|
|
1811
|
+
readonly flows: {
|
|
1812
|
+
readonly implicit?: {
|
|
1813
|
+
readonly authorizationUrl?: string | undefined;
|
|
1814
|
+
readonly tokenUrl?: string | undefined;
|
|
1815
|
+
readonly refreshUrl?: string | undefined;
|
|
1816
|
+
readonly scopes?: {
|
|
1817
|
+
readonly [x: string]: string;
|
|
1818
|
+
} | undefined;
|
|
1819
|
+
} | undefined;
|
|
1820
|
+
readonly password?: {
|
|
1821
|
+
readonly authorizationUrl?: string | undefined;
|
|
1822
|
+
readonly tokenUrl?: string | undefined;
|
|
1823
|
+
readonly refreshUrl?: string | undefined;
|
|
1824
|
+
readonly scopes?: {
|
|
1825
|
+
readonly [x: string]: string;
|
|
1826
|
+
} | undefined;
|
|
1827
|
+
} | undefined;
|
|
1828
|
+
readonly clientCredentials?: {
|
|
1829
|
+
readonly authorizationUrl?: string | undefined;
|
|
1830
|
+
readonly tokenUrl?: string | undefined;
|
|
1831
|
+
readonly refreshUrl?: string | undefined;
|
|
1832
|
+
readonly scopes?: {
|
|
1833
|
+
readonly [x: string]: string;
|
|
1834
|
+
} | undefined;
|
|
1835
|
+
} | undefined;
|
|
1836
|
+
readonly authorizationCode?: {
|
|
1837
|
+
readonly authorizationUrl?: string | undefined;
|
|
1838
|
+
readonly tokenUrl?: string | undefined;
|
|
1839
|
+
readonly refreshUrl?: string | undefined;
|
|
1840
|
+
readonly scopes?: {
|
|
1841
|
+
readonly [x: string]: string;
|
|
1842
|
+
} | undefined;
|
|
1843
|
+
} | undefined;
|
|
1844
|
+
};
|
|
1845
|
+
} | {
|
|
1846
|
+
readonly name: string;
|
|
1847
|
+
readonly description?: string | undefined;
|
|
1848
|
+
readonly type: "openIdConnect";
|
|
1849
|
+
readonly openIdConnectUrl: string;
|
|
1850
|
+
})[];
|
|
1851
|
+
readonly securityRequirements: readonly {
|
|
1852
|
+
readonly [x: string]: readonly string[];
|
|
1853
|
+
}[];
|
|
1854
|
+
}, ConfigError, never>;
|
|
1855
|
+
}, never, never>;
|
|
1856
|
+
}>;
|
|
1857
|
+
/**
|
|
1858
|
+
* Business service facade for config orchestration.
|
|
1859
|
+
*/
|
|
1860
|
+
declare class ConfigService extends ConfigService_base {
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
/**
|
|
1864
|
+
* OpenAPI spec validation utilities.
|
|
1865
|
+
*
|
|
1866
|
+
* Validates that generated specs don't have broken $ref references
|
|
1867
|
+
* or other common issues.
|
|
1868
|
+
*/
|
|
1869
|
+
|
|
1870
|
+
/**
|
|
1871
|
+
* A broken reference found during validation
|
|
1872
|
+
*/
|
|
1873
|
+
interface BrokenRef {
|
|
1874
|
+
/** The $ref value that couldn't be resolved */
|
|
1875
|
+
readonly ref: string;
|
|
1876
|
+
/** The JSON path where this reference was found */
|
|
1877
|
+
readonly path: string;
|
|
1878
|
+
/** The schema name that's missing (extracted from $ref) */
|
|
1879
|
+
readonly missingSchema: string;
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Result of spec validation
|
|
1883
|
+
*/
|
|
1884
|
+
interface ValidationResult {
|
|
1885
|
+
/** Whether the spec is valid (no broken refs) */
|
|
1886
|
+
readonly valid: boolean;
|
|
1887
|
+
/** Total number of schema refs found */
|
|
1888
|
+
readonly totalRefs: number;
|
|
1889
|
+
/** Number of broken refs */
|
|
1890
|
+
readonly brokenRefCount: number;
|
|
1891
|
+
/** Details of each broken ref */
|
|
1892
|
+
readonly brokenRefs: readonly BrokenRef[];
|
|
1893
|
+
/** Missing schema names grouped with their usage count */
|
|
1894
|
+
readonly missingSchemas: ReadonlyMap<string, number>;
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Validates an OpenAPI spec for broken $ref references.
|
|
1898
|
+
*
|
|
1899
|
+
* @param spec - The OpenAPI specification to validate
|
|
1900
|
+
* @returns Validation result with details about any broken refs
|
|
1901
|
+
*
|
|
1902
|
+
* @example
|
|
1903
|
+
* ```typescript
|
|
1904
|
+
* const result = validateSpec(spec);
|
|
1905
|
+
* if (!result.valid) {
|
|
1906
|
+
* console.error(`Found ${result.brokenRefCount} broken refs:`);
|
|
1907
|
+
* for (const [schema, count] of result.missingSchemas) {
|
|
1908
|
+
* console.error(` - ${schema} (${count} usages)`);
|
|
1909
|
+
* }
|
|
1910
|
+
* }
|
|
1911
|
+
* ```
|
|
1912
|
+
*/
|
|
1913
|
+
declare function validateSpec(spec: OpenApiSpec): ValidationResult;
|
|
1914
|
+
/**
|
|
1915
|
+
* Categorizes broken refs by likely cause
|
|
1916
|
+
*/
|
|
1917
|
+
interface BrokenRefCategories {
|
|
1918
|
+
/** Primitive types that shouldn't be refs (string, number, boolean) */
|
|
1919
|
+
readonly primitives: readonly string[];
|
|
1920
|
+
/** Union types (Type | null, void | Type) */
|
|
1921
|
+
readonly unionTypes: readonly string[];
|
|
1922
|
+
/** Query/Path parameter DTOs */
|
|
1923
|
+
readonly queryParams: readonly string[];
|
|
1924
|
+
/** Other missing schemas (likely from different glob patterns) */
|
|
1925
|
+
readonly other: readonly string[];
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Categorize broken refs to help diagnose the root cause.
|
|
1929
|
+
*
|
|
1930
|
+
* @param missingSchemas - Map of missing schema names to usage count
|
|
1931
|
+
* @returns Categorized broken refs
|
|
1932
|
+
*/
|
|
1933
|
+
declare function categorizeBrokenRefs(missingSchemas: ReadonlyMap<string, number>): BrokenRefCategories;
|
|
1934
|
+
/**
|
|
1935
|
+
* Formats validation result as a human-readable string for CLI output.
|
|
1936
|
+
*
|
|
1937
|
+
* @param result - Validation result from validateSpec
|
|
1938
|
+
* @returns Formatted string describing the validation issues
|
|
1939
|
+
*/
|
|
1940
|
+
declare function formatValidationResult(result: ValidationResult): string;
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Schema Generator - Wraps ts-json-schema-generator with Effect
|
|
1944
|
+
*
|
|
1945
|
+
* This module generates JSON Schema definitions from TypeScript DTO files.
|
|
1946
|
+
*/
|
|
1947
|
+
|
|
1948
|
+
type SchemaError = SchemaGenerationError;
|
|
1949
|
+
|
|
1950
|
+
interface GeneratedSchemas {
|
|
1951
|
+
readonly definitions: Record<string, JsonSchema>;
|
|
1952
|
+
}
|
|
1953
|
+
interface JsonSchema {
|
|
1954
|
+
readonly type?: string | readonly string[];
|
|
1955
|
+
readonly format?: string;
|
|
1956
|
+
readonly $ref?: string;
|
|
1957
|
+
readonly properties?: Record<string, JsonSchema>;
|
|
1958
|
+
readonly required?: readonly string[];
|
|
1959
|
+
readonly items?: JsonSchema;
|
|
1960
|
+
readonly enum?: readonly unknown[];
|
|
1961
|
+
readonly oneOf?: readonly JsonSchema[];
|
|
1962
|
+
readonly anyOf?: readonly JsonSchema[];
|
|
1963
|
+
readonly allOf?: readonly JsonSchema[];
|
|
1964
|
+
readonly description?: string;
|
|
1965
|
+
readonly minimum?: number;
|
|
1966
|
+
readonly maximum?: number;
|
|
1967
|
+
readonly minLength?: number;
|
|
1968
|
+
readonly maxLength?: number;
|
|
1969
|
+
readonly pattern?: string;
|
|
1970
|
+
readonly default?: unknown;
|
|
1971
|
+
readonly additionalProperties?: boolean | JsonSchema;
|
|
1972
|
+
readonly [key: string]: unknown;
|
|
1973
|
+
}
|
|
1974
|
+
interface SchemaGeneratorOptions {
|
|
1975
|
+
/** Glob patterns for DTO files */
|
|
1976
|
+
readonly dtoGlob: readonly string[];
|
|
1977
|
+
/** Path to tsconfig.json */
|
|
1978
|
+
readonly tsconfig: string;
|
|
1979
|
+
/** Base directory for resolving globs */
|
|
1980
|
+
readonly basePath: string;
|
|
1981
|
+
/** Optional shared TypeScript program to reuse compiler context */
|
|
1982
|
+
readonly reuseProgram?: unknown;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Generate JSON Schema definitions from TypeScript DTO files
|
|
1986
|
+
*/
|
|
1987
|
+
declare const generateSchemas: (options: SchemaGeneratorOptions) => Effect.Effect<GeneratedSchemas, SchemaGenerationError, never>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Generate schemas from a specific list of file paths.
|
|
1990
|
+
* This is used for the hybrid approach to generate schemas for
|
|
1991
|
+
* types that weren't covered by the initial dtoGlob patterns.
|
|
1992
|
+
*
|
|
1993
|
+
* Uses a temporary tsconfig with only the specified files for better performance.
|
|
1994
|
+
* Falls back to individual file processing if the batched approach fails.
|
|
1995
|
+
*/
|
|
1996
|
+
declare const generateSchemasFromFiles: (filePaths: readonly string[], tsconfig: string) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
1997
|
+
|
|
1998
|
+
declare const SchemaService_base: Effect.Service.Class<SchemaService, "SchemaService", {
|
|
1999
|
+
readonly accessors: true;
|
|
2000
|
+
readonly effect: Effect.Effect<{
|
|
2001
|
+
generateSchemas: (options: SchemaGeneratorOptions) => Effect.Effect<GeneratedSchemas, SchemaGenerationError, never>;
|
|
2002
|
+
generateSchemasFromFiles: (filePaths: readonly string[], tsconfig: string) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
2003
|
+
}, never, never>;
|
|
2004
|
+
}>;
|
|
2005
|
+
declare class SchemaService extends SchemaService_base {
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
/**
|
|
2009
|
+
* Validation Mapper - Maps class-validator decorators to OpenAPI constraints
|
|
2010
|
+
*
|
|
2011
|
+
* This module extracts validation information from class-validator decorators
|
|
2012
|
+
* in TypeScript source files and applies them to JSON Schema definitions.
|
|
2013
|
+
*/
|
|
2014
|
+
|
|
2015
|
+
interface ValidationConstraints {
|
|
2016
|
+
readonly minLength?: number;
|
|
2017
|
+
readonly maxLength?: number;
|
|
2018
|
+
readonly pattern?: string;
|
|
2019
|
+
readonly format?: string;
|
|
2020
|
+
readonly minimum?: number;
|
|
2021
|
+
readonly maximum?: number;
|
|
2022
|
+
readonly exclusiveMinimum?: number | boolean;
|
|
2023
|
+
readonly exclusiveMaximum?: number | boolean;
|
|
2024
|
+
readonly multipleOf?: number;
|
|
2025
|
+
readonly minItems?: number;
|
|
2026
|
+
readonly maxItems?: number;
|
|
2027
|
+
readonly uniqueItems?: boolean;
|
|
2028
|
+
readonly enum?: readonly unknown[];
|
|
2029
|
+
readonly type?: string;
|
|
2030
|
+
readonly description?: string;
|
|
2031
|
+
readonly title?: string;
|
|
2032
|
+
readonly example?: unknown;
|
|
2033
|
+
readonly default?: unknown;
|
|
2034
|
+
readonly deprecated?: boolean;
|
|
2035
|
+
readonly readOnly?: boolean;
|
|
2036
|
+
readonly writeOnly?: boolean;
|
|
2037
|
+
readonly nullable?: boolean;
|
|
2038
|
+
readonly isArray?: boolean;
|
|
2039
|
+
readonly hidden?: boolean;
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Result of extracting property validation info in a single pass
|
|
2043
|
+
*/
|
|
2044
|
+
interface PropertyValidationInfo {
|
|
2045
|
+
readonly isOptional: boolean;
|
|
2046
|
+
readonly constraints: ValidationConstraints;
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Result of extracting validation metadata from an entire class.
|
|
2050
|
+
* Collected in a single pass over properties.
|
|
2051
|
+
*/
|
|
2052
|
+
interface ClassValidationInfo {
|
|
2053
|
+
readonly constraints: Record<string, ValidationConstraints>;
|
|
2054
|
+
readonly required: readonly string[];
|
|
2055
|
+
}
|
|
2056
|
+
/**
|
|
2057
|
+
* Extract validation constraints from a property's decorators
|
|
2058
|
+
*/
|
|
2059
|
+
declare const extractPropertyConstraints: (property: PropertyDeclaration) => ValidationConstraints;
|
|
2060
|
+
/**
|
|
2061
|
+
* Check if a property has @IsOptional() decorator
|
|
2062
|
+
*/
|
|
2063
|
+
declare const isPropertyOptional: (property: PropertyDeclaration) => boolean;
|
|
2064
|
+
/**
|
|
2065
|
+
* Extract both optionality and constraints from a property in a single pass.
|
|
2066
|
+
* This is more efficient than calling isPropertyOptional and extractPropertyConstraints separately.
|
|
2067
|
+
*/
|
|
2068
|
+
declare const extractPropertyValidationInfo: (property: PropertyDeclaration) => PropertyValidationInfo;
|
|
2069
|
+
/**
|
|
2070
|
+
* Extract class-level validation metadata in one pass.
|
|
2071
|
+
*/
|
|
2072
|
+
declare const extractClassValidationInfo: (classDecl: ClassDeclaration) => ClassValidationInfo;
|
|
2073
|
+
/**
|
|
2074
|
+
* Extract all property constraints from a class
|
|
2075
|
+
*/
|
|
2076
|
+
declare const extractClassConstraints: (classDecl: ClassDeclaration) => Record<string, ValidationConstraints>;
|
|
2077
|
+
/**
|
|
2078
|
+
* Get required property names from a class (those without @IsOptional)
|
|
2079
|
+
*/
|
|
2080
|
+
declare const getRequiredProperties: (classDecl: ClassDeclaration) => readonly string[];
|
|
2081
|
+
/**
|
|
2082
|
+
* Apply validation constraints to a JSON Schema
|
|
2083
|
+
*/
|
|
2084
|
+
declare const applyConstraintsToSchema: (schema: JsonSchema, propertyConstraints: Record<string, ValidationConstraints>, requiredProperties?: readonly string[]) => JsonSchema;
|
|
2085
|
+
/**
|
|
2086
|
+
* Merge validation constraints into generated schemas
|
|
2087
|
+
*/
|
|
2088
|
+
declare const mergeValidationConstraints: (schemas: GeneratedSchemas, classConstraints: Map<string, Record<string, ValidationConstraints>>, classRequired: Map<string, readonly string[]>) => GeneratedSchemas;
|
|
2089
|
+
/**
|
|
2090
|
+
* Effect-native wrapper with trace annotations for class validation extraction.
|
|
2091
|
+
*/
|
|
2092
|
+
declare const extractClassValidationInfoEffect: (classDecl: ClassDeclaration) => Effect.Effect<ClassValidationInfo, ValidationMappingError, never>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Effect-native wrapper with trace annotations for schema merge.
|
|
2095
|
+
*/
|
|
2096
|
+
declare const mergeValidationConstraintsEffect: (schemas: GeneratedSchemas, classConstraints: Map<string, Record<string, ValidationConstraints>>, classRequired: Map<string, readonly string[]>) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
2097
|
+
|
|
2098
|
+
declare const ValidationService_base: Effect.Service.Class<ValidationService, "ValidationService", {
|
|
2099
|
+
readonly accessors: true;
|
|
2100
|
+
readonly effect: Effect.Effect<{
|
|
2101
|
+
extractClassValidationInfo: (classDecl: ClassDeclaration) => Effect.Effect<ClassValidationInfo, ValidationMappingError, never>;
|
|
2102
|
+
mergeValidationConstraints: (schemas: GeneratedSchemas, classConstraints: Map<string, Record<string, ValidationConstraints>>, classRequired: Map<string, readonly string[]>) => Effect.Effect<GeneratedSchemas, never, never>;
|
|
2103
|
+
}, never, never>;
|
|
2104
|
+
}>;
|
|
2105
|
+
declare class ValidationService extends ValidationService_base {
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
declare const OutputService_base: Effect.Service.Class<OutputService, "OutputService", {
|
|
2109
|
+
readonly accessors: true;
|
|
2110
|
+
readonly effect: Effect.Effect<{
|
|
2111
|
+
ensureOutputDirectory: (outputPath: string) => Effect.Effect<void, OutputDirectoryCreationError, never>;
|
|
2112
|
+
serializeSpec: (spec: OpenApiSpec, outputPath: string, format: "json" | "yaml") => Effect.Effect<string, OutputSerializationError, never>;
|
|
2113
|
+
writeOutput: (outputPath: string, content: string, format: "json" | "yaml") => Effect.Effect<void, OutputWriteError, never>;
|
|
2114
|
+
}, never, never>;
|
|
2115
|
+
}>;
|
|
2116
|
+
declare class OutputService extends OutputService_base {
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
interface GenerateResult {
|
|
2120
|
+
/** Path where the OpenAPI spec was written */
|
|
2121
|
+
readonly outputPath: string;
|
|
2122
|
+
/** Number of paths in the generated spec */
|
|
2123
|
+
readonly pathCount: number;
|
|
2124
|
+
/** Number of operations in the generated spec */
|
|
2125
|
+
readonly operationCount: number;
|
|
2126
|
+
/** Number of schemas in the generated spec */
|
|
2127
|
+
readonly schemaCount: number;
|
|
2128
|
+
/** Validation result checking for broken refs */
|
|
2129
|
+
readonly validation: ValidationResult;
|
|
2130
|
+
}
|
|
2131
|
+
/**
|
|
2132
|
+
* Promise-based public compatibility wrapper.
|
|
2133
|
+
*/
|
|
2134
|
+
declare const generate$1: (configPath: string, overrides?: GenerateOverrides) => Promise<GenerateResult>;
|
|
2135
|
+
|
|
2136
|
+
interface ProjectContext {
|
|
2137
|
+
readonly project: Project;
|
|
2138
|
+
readonly entrySourceFile: SourceFile;
|
|
2139
|
+
readonly entryClass: ClassDeclaration;
|
|
2140
|
+
}
|
|
2141
|
+
interface ProjectOptions {
|
|
2142
|
+
readonly tsconfig: string;
|
|
2143
|
+
readonly entry: string;
|
|
2144
|
+
}
|
|
2145
|
+
declare const makeProjectContext: (options: ProjectOptions) => Effect.Effect<{
|
|
2146
|
+
project: Project;
|
|
2147
|
+
entrySourceFile: SourceFile;
|
|
2148
|
+
entryClass: ClassDeclaration;
|
|
2149
|
+
}, ProjectInitError | EntryNotFoundError, never>;
|
|
2150
|
+
declare const ProjectService_base: Effect.Service.Class<ProjectService, "ProjectService", {
|
|
2151
|
+
readonly accessors: true;
|
|
2152
|
+
readonly effect: Effect.Effect<{
|
|
2153
|
+
makeProjectContext: (options: ProjectOptions) => Effect.Effect<{
|
|
2154
|
+
project: Project;
|
|
2155
|
+
entrySourceFile: SourceFile;
|
|
2156
|
+
entryClass: ClassDeclaration;
|
|
2157
|
+
}, ProjectInitError | EntryNotFoundError, never>;
|
|
2158
|
+
}, never, never>;
|
|
2159
|
+
}>;
|
|
2160
|
+
declare class ProjectService extends ProjectService_base {
|
|
2161
|
+
}
|
|
2162
|
+
declare const ProjectServiceLive: (_options: ProjectOptions) => Layer.Layer<ProjectService, never>;
|
|
2163
|
+
|
|
2164
|
+
interface GenerateOptions {
|
|
2165
|
+
readonly tsconfig: string;
|
|
2166
|
+
readonly entry: string;
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* Low-level path-only Effect API from entry + tsconfig.
|
|
2170
|
+
*/
|
|
2171
|
+
declare const generatePathsEffect: (options: GenerateOptions) => Effect.Effect<{
|
|
2172
|
+
[path: string]: {
|
|
2173
|
+
[method: string]: {
|
|
2174
|
+
readonly parameters?: readonly {
|
|
2175
|
+
readonly name: string;
|
|
2176
|
+
readonly required: boolean;
|
|
2177
|
+
readonly description?: string | undefined;
|
|
2178
|
+
readonly in: "path" | "query" | "header" | "cookie";
|
|
2179
|
+
readonly schema: OpenApiSchema;
|
|
2180
|
+
}[] | undefined;
|
|
2181
|
+
readonly description?: string | undefined;
|
|
2182
|
+
readonly summary?: string | undefined;
|
|
2183
|
+
readonly operationId: string;
|
|
2184
|
+
readonly deprecated?: boolean | undefined;
|
|
2185
|
+
readonly responses: {
|
|
2186
|
+
readonly [x: string]: {
|
|
2187
|
+
readonly description: string;
|
|
2188
|
+
readonly content?: {
|
|
2189
|
+
readonly [x: string]: {
|
|
2190
|
+
readonly schema: unknown;
|
|
2191
|
+
};
|
|
2192
|
+
} | undefined;
|
|
2193
|
+
};
|
|
2194
|
+
};
|
|
2195
|
+
readonly security?: readonly {
|
|
2196
|
+
readonly [x: string]: readonly string[];
|
|
2197
|
+
}[] | undefined;
|
|
2198
|
+
readonly requestBody?: {
|
|
2199
|
+
readonly required?: boolean | undefined;
|
|
2200
|
+
readonly description?: string | undefined;
|
|
2201
|
+
readonly content: {
|
|
2202
|
+
readonly [x: string]: {
|
|
2203
|
+
readonly schema: unknown;
|
|
2204
|
+
};
|
|
2205
|
+
};
|
|
2206
|
+
} | undefined;
|
|
2207
|
+
readonly tags?: readonly string[] | undefined;
|
|
2208
|
+
};
|
|
2209
|
+
};
|
|
2210
|
+
}, ProjectInitError | EntryNotFoundError, ModuleTraversalService | ProjectService | MethodExtractionService>;
|
|
2211
|
+
/**
|
|
2212
|
+
* Canonical config-file based Effect API.
|
|
2213
|
+
*/
|
|
2214
|
+
declare const generateFromConfigEffect: (configPath: string, overrides?: GenerateOverrides | undefined) => Effect.Effect<{
|
|
2215
|
+
outputPath: string;
|
|
2216
|
+
pathCount: number;
|
|
2217
|
+
operationCount: number;
|
|
2218
|
+
schemaCount: number;
|
|
2219
|
+
validation: ValidationResult;
|
|
2220
|
+
}, EntryNotFoundError | ConfigError | SchemaGenerationError | ValidationMappingError | DtoGlobResolutionError | MissingGenericSchemaTempFileWriteError | OutputDirectoryCreationError | OutputSerializationError | OutputWriteError, ModuleTraversalService | MethodExtractionService | ConfigService | SchemaService | ValidationService | OutputService>;
|
|
2221
|
+
/**
|
|
2222
|
+
* Promise wrapper for path-only API.
|
|
2223
|
+
*/
|
|
2224
|
+
declare const generatePathsAsync: (options: GenerateOptions) => Promise<OpenApiPaths>;
|
|
2225
|
+
/**
|
|
2226
|
+
* Promise wrapper for canonical config-file API.
|
|
2227
|
+
*/
|
|
2228
|
+
declare const generateFromConfigAsync: (configPath: string, overrides?: GenerateOverrides) => Promise<GenerateResult>;
|
|
2229
|
+
/**
|
|
2230
|
+
* Backward-compatible aliases.
|
|
2231
|
+
*/
|
|
2232
|
+
declare const generate: (options: GenerateOptions) => Effect.Effect<{
|
|
2233
|
+
[path: string]: {
|
|
2234
|
+
[method: string]: {
|
|
2235
|
+
readonly parameters?: readonly {
|
|
2236
|
+
readonly name: string;
|
|
2237
|
+
readonly required: boolean;
|
|
2238
|
+
readonly description?: string | undefined;
|
|
2239
|
+
readonly in: "path" | "query" | "header" | "cookie";
|
|
2240
|
+
readonly schema: OpenApiSchema;
|
|
2241
|
+
}[] | undefined;
|
|
2242
|
+
readonly description?: string | undefined;
|
|
2243
|
+
readonly summary?: string | undefined;
|
|
2244
|
+
readonly operationId: string;
|
|
2245
|
+
readonly deprecated?: boolean | undefined;
|
|
2246
|
+
readonly responses: {
|
|
2247
|
+
readonly [x: string]: {
|
|
2248
|
+
readonly description: string;
|
|
2249
|
+
readonly content?: {
|
|
2250
|
+
readonly [x: string]: {
|
|
2251
|
+
readonly schema: unknown;
|
|
2252
|
+
};
|
|
2253
|
+
} | undefined;
|
|
2254
|
+
};
|
|
2255
|
+
};
|
|
2256
|
+
readonly security?: readonly {
|
|
2257
|
+
readonly [x: string]: readonly string[];
|
|
2258
|
+
}[] | undefined;
|
|
2259
|
+
readonly requestBody?: {
|
|
2260
|
+
readonly required?: boolean | undefined;
|
|
2261
|
+
readonly description?: string | undefined;
|
|
2262
|
+
readonly content: {
|
|
2263
|
+
readonly [x: string]: {
|
|
2264
|
+
readonly schema: unknown;
|
|
2265
|
+
};
|
|
2266
|
+
};
|
|
2267
|
+
} | undefined;
|
|
2268
|
+
readonly tags?: readonly string[] | undefined;
|
|
2269
|
+
};
|
|
2270
|
+
};
|
|
2271
|
+
}, ProjectInitError | EntryNotFoundError, ModuleTraversalService | ProjectService | MethodExtractionService>;
|
|
2272
|
+
declare const generateAsync: (options: GenerateOptions) => Promise<OpenApiPaths>;
|
|
2273
|
+
|
|
2274
|
+
export { MissingGenericSchemaTempFileCleanupError as $, generatePathsAsync as A, generateFromConfigEffect as B, ConfigService as C, generateFromConfigAsync as D, ParameterLocation as F, ReturnTypeInfo as H, HttpMethod as J, OpenApiGeneratorConfig as K, MethodInfo as M, ResolvedConfig as N, ProjectService as P, ProjectInitError as Q, ResolvedParameter as R, SpecFileNotFoundError as S, EntryNotFoundError as U, ValidationService as V, ConfigNotFoundError as W, ConfigLoadError as X, ConfigValidationError as Y, DtoGlobResolutionError as Z, InvalidMethodError as _, SpecFileReadError as a, MissingGenericSchemaTempFileWriteError as a0, PublicApiError as a1, ProjectServiceLive as a6, makeProjectContext as a7, findConfigFile as aA, loadConfigFromFile as aB, loadConfig as aC, resolveConfig as aD, loadAndResolveConfig as aE, validateSpec as aF, categorizeBrokenRefs as aG, formatValidationResult as aH, getModules as aa, getAllControllers as ab, getMethodInfo as ad, getMethodInfoEffect as ae, getControllerMethodInfos as af, getControllerMethodInfosEffect as ag, generateSchemas as ah, generateSchemasFromFiles as ai, SchemaGenerationError as aj, extractPropertyConstraints as an, isPropertyOptional as ao, extractPropertyValidationInfo as ap, extractClassValidationInfo as aq, extractClassValidationInfoEffect as ar, extractClassConstraints as as, getRequiredProperties as at, applyConstraintsToSchema as au, mergeValidationConstraints as av, mergeValidationConstraintsEffect as aw, SpecFileParseError as b, OpenApiOperation as d, ModuleTraversalService as g, MethodExtractionService as h, SchemaService as i, OutputService as j, generate$1 as k, defineConfig as m, generate as x, generateAsync as y, generatePathsEffect as z };
|
|
2275
|
+
export type { GenerateOptions as E, GeneratedSchemas as G, InfoConfig as I, LicenseConfig as L, OpenApiSpec as O, TagConfig as T, ProjectError as a2, ConfigError as a3, AnalysisError as a4, GeneratorError as a5, ProjectContext as a8, ProjectOptions as a9, ValidationResult as aI, BrokenRef as aJ, BrokenRefCategories as aK, ModuleWithControllers as ac, SchemaError as ak, SchemaGeneratorOptions as al, JsonSchema as am, ValidationConstraints as ax, PropertyValidationInfo as ay, ClassValidationInfo as az, OpenApiPaths as c, OpenApiPaths$1 as e, OpenApiSchema$1 as f, GenerateResult as l, Config as n, ContactConfig as o, ServerConfig as p, OutputFormat as q, TelemetryConfig as r, GenerateOverrides as s, OpenApiOperation$1 as t, OpenApiParameter as u, OpenApiRequestBody as v, OpenApiResponse as w };
|