nestjs-openapi 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +79 -11
- package/dist/index.d.ts +79 -11
- package/dist/index.mjs +146 -28
- package/dist/internal.d.mts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/shared/{nestjs-openapi.C1csrdEX.d.mts → nestjs-openapi.CAanamW0.d.mts} +58 -58
- package/dist/shared/{nestjs-openapi.C1csrdEX.d.ts → nestjs-openapi.CAanamW0.d.ts} +58 -58
- package/dist/shared/{nestjs-openapi.0ft_UaiO.mjs → nestjs-openapi.Nd-wGr8A.mjs} +2 -6
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import 'tsx';
|
|
3
3
|
import { Effect, Exit, Cause, Option } from 'effect';
|
|
4
|
-
import { ax as generateEffect, ak as generatorServicesLayer, az as runtimeLayerFor, aw as formatValidationResult } from './shared/nestjs-openapi.
|
|
4
|
+
import { ax as generateEffect, ak as generatorServicesLayer, az as runtimeLayerFor, aw as formatValidationResult } from './shared/nestjs-openapi.Nd-wGr8A.mjs';
|
|
5
5
|
import minimist from 'minimist';
|
|
6
6
|
import { relative } from 'node:path';
|
|
7
7
|
import { createRequire } from 'node:module';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OpenApiSpec, S as SpecFileNotFoundError, a as SpecFileReadError, b as SpecFileParseError, M as MethodInfo, c as OpenApiPaths, d as OpenApiOperation, e as OpenApiPaths$1, G as GeneratedSchemas, f as OpenApiSchema,
|
|
2
|
-
export { a4 as AnalysisError, aJ as BrokenRef, aK as BrokenRefCategories, az as ClassValidationInfo, n as Config, a3 as ConfigError, X as ConfigLoadError, W as ConfigNotFoundError, Y as ConfigValidationError, o as ContactConfig, Z as DtoGlobResolutionError, U as EntryNotFoundError, E as GenerateOptions, s as GenerateOverrides, l as GenerateResult, a5 as GeneratorError, J as HttpMethod, I as InfoConfig, _ as InvalidMethodError, am as JsonSchema, L as LicenseConfig, $ as MissingGenericSchemaTempFileCleanupError, a0 as MissingGenericSchemaTempFileWriteError, ac as ModuleWithControllers, K as OpenApiGeneratorConfig, t as OpenApiOperation, u as OpenApiParameter, v as OpenApiRequestBody, w as OpenApiResponse, q as OutputFormat, F as ParameterLocation, a8 as ProjectContext, a2 as ProjectError, Q as ProjectInitError, a9 as ProjectOptions, a6 as ProjectServiceLive, ay as PropertyValidationInfo, a1 as PublicApiError, N as ResolvedConfig, R as ResolvedParameter, H as ReturnTypeInfo, ak as SchemaError, aj as SchemaGenerationError, al as SchemaGeneratorOptions, p as ServerConfig, T as TagConfig, r as TelemetryConfig, ax as ValidationConstraints, aI as ValidationResult, au as applyConstraintsToSchema, aG as categorizeBrokenRefs, m as defineConfig, as as extractClassConstraints, aq as extractClassValidationInfo, ar as extractClassValidationInfoEffect, an as extractPropertyConstraints, ap as extractPropertyValidationInfo, aA as findConfigFile, aH as formatValidationResult, k as generate, y as generateAsync, x as generateEffect, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect, ah as generateSchemas, ai as generateSchemasFromFiles, ab as getAllControllers, af as getControllerMethodInfos, ag as getControllerMethodInfosEffect, ad as getMethodInfo, ae as getMethodInfoEffect, aa as getModules, at as getRequiredProperties, ao as isPropertyOptional, aE as loadAndResolveConfig, aC as loadConfig, aB as loadConfigFromFile, a7 as makeProjectContext, av as mergeValidationConstraints, aw as mergeValidationConstraintsEffect, aD as resolveConfig, aF as validateSpec } from './shared/nestjs-openapi.
|
|
1
|
+
import { O as OpenApiSpec, S as SpecFileNotFoundError, a as SpecFileReadError, b as SpecFileParseError, M as MethodInfo, c as OpenApiPaths, d as OpenApiOperation, e as OpenApiPaths$1, G as GeneratedSchemas, f as OpenApiSchema, P as ProjectService, g as ModuleTraversalService, C as ConfigService, h as SchemaService, V as ValidationService, i as MethodExtractionService, j as OutputService } from './shared/nestjs-openapi.CAanamW0.mjs';
|
|
2
|
+
export { a4 as AnalysisError, aJ as BrokenRef, aK as BrokenRefCategories, az as ClassValidationInfo, n as Config, a3 as ConfigError, X as ConfigLoadError, W as ConfigNotFoundError, Y as ConfigValidationError, o as ContactConfig, Z as DtoGlobResolutionError, U as EntryNotFoundError, E as GenerateOptions, s as GenerateOverrides, l as GenerateResult, a5 as GeneratorError, J as HttpMethod, I as InfoConfig, _ as InvalidMethodError, am as JsonSchema, L as LicenseConfig, $ as MissingGenericSchemaTempFileCleanupError, a0 as MissingGenericSchemaTempFileWriteError, ac as ModuleWithControllers, K as OpenApiGeneratorConfig, t as OpenApiOperation, u as OpenApiParameter, v as OpenApiRequestBody, w as OpenApiResponse, q as OutputFormat, F as ParameterLocation, a8 as ProjectContext, a2 as ProjectError, Q as ProjectInitError, a9 as ProjectOptions, a6 as ProjectServiceLive, ay as PropertyValidationInfo, a1 as PublicApiError, N as ResolvedConfig, R as ResolvedParameter, H as ReturnTypeInfo, ak as SchemaError, aj as SchemaGenerationError, al as SchemaGeneratorOptions, p as ServerConfig, T as TagConfig, r as TelemetryConfig, ax as ValidationConstraints, aI as ValidationResult, au as applyConstraintsToSchema, aG as categorizeBrokenRefs, m as defineConfig, as as extractClassConstraints, aq as extractClassValidationInfo, ar as extractClassValidationInfoEffect, an as extractPropertyConstraints, ap as extractPropertyValidationInfo, aA as findConfigFile, aH as formatValidationResult, k as generate, y as generateAsync, x as generateEffect, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect, ah as generateSchemas, ai as generateSchemasFromFiles, ab as getAllControllers, af as getControllerMethodInfos, ag as getControllerMethodInfosEffect, ad as getMethodInfo, ae as getMethodInfoEffect, aa as getModules, at as getRequiredProperties, ao as isPropertyOptional, aE as loadAndResolveConfig, aC as loadConfig, aB as loadConfigFromFile, a7 as makeProjectContext, av as mergeValidationConstraints, aw as mergeValidationConstraintsEffect, aD as resolveConfig, aF as validateSpec } from './shared/nestjs-openapi.CAanamW0.mjs';
|
|
3
3
|
import { DynamicModule } from '@nestjs/common';
|
|
4
4
|
import { Effect, Option, Layer } from 'effect';
|
|
5
5
|
import { ClassDeclaration, MethodDeclaration, Decorator, Symbol, ObjectLiteralExpression, Expression } from 'ts-morph';
|
|
@@ -38,10 +38,24 @@ interface SwaggerOptions {
|
|
|
38
38
|
*/
|
|
39
39
|
readonly title?: string;
|
|
40
40
|
}
|
|
41
|
+
interface LoadSpecFileOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Additional spec files to try when the primary file is missing.
|
|
44
|
+
*/
|
|
45
|
+
readonly fallbackSpecFiles?: readonly string[];
|
|
46
|
+
}
|
|
47
|
+
interface OpenApiDocumentFileSource extends LoadSpecFileOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Path to the generated OpenAPI JSON file.
|
|
50
|
+
* Can be absolute or relative to the current working directory.
|
|
51
|
+
*/
|
|
52
|
+
readonly specFile: string;
|
|
53
|
+
}
|
|
54
|
+
type OpenApiDocumentSource = OpenApiSpec | (() => OpenApiSpec) | OpenApiDocumentFileSource;
|
|
41
55
|
/**
|
|
42
56
|
* Configuration options for the OpenAPI module
|
|
43
57
|
*/
|
|
44
|
-
interface OpenApiModuleOptions {
|
|
58
|
+
interface OpenApiModuleOptions extends LoadSpecFileOptions {
|
|
45
59
|
/**
|
|
46
60
|
* Path to the generated OpenAPI JSON file.
|
|
47
61
|
* Can be absolute or relative to the current working directory.
|
|
@@ -72,6 +86,7 @@ interface OpenApiModuleOptions {
|
|
|
72
86
|
*/
|
|
73
87
|
interface ResolvedOpenApiModuleOptions {
|
|
74
88
|
readonly specFile: string;
|
|
89
|
+
readonly fallbackSpecFiles: readonly string[];
|
|
75
90
|
readonly enabled: boolean;
|
|
76
91
|
readonly jsonPath: string;
|
|
77
92
|
readonly swagger: {
|
|
@@ -88,6 +103,52 @@ declare const OPENAPI_MODULE_OPTIONS: unique symbol;
|
|
|
88
103
|
* Injection token for the loaded OpenAPI specification
|
|
89
104
|
*/
|
|
90
105
|
declare const OPENAPI_SPEC: unique symbol;
|
|
106
|
+
interface OpenApiRouteRegistrar {
|
|
107
|
+
readonly get: (path: string, handler: (request: unknown, response: unknown) => void) => void;
|
|
108
|
+
}
|
|
109
|
+
interface OpenApiHttpApplication {
|
|
110
|
+
readonly config?: {
|
|
111
|
+
readonly getGlobalPrefix?: () => string;
|
|
112
|
+
};
|
|
113
|
+
readonly getHttpAdapter: () => OpenApiRouteRegistrar;
|
|
114
|
+
}
|
|
115
|
+
interface OpenApiSetupOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Whether OpenAPI routes should be registered.
|
|
118
|
+
* @default true
|
|
119
|
+
*/
|
|
120
|
+
readonly enabled?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Prefix OpenAPI routes with the app's `setGlobalPrefix()` value.
|
|
123
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.useGlobalPrefix`.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
readonly useGlobalPrefix?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Raw OpenAPI JSON endpoint path.
|
|
129
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.jsonDocumentUrl`.
|
|
130
|
+
* @default `${docsPath}-json`
|
|
131
|
+
*/
|
|
132
|
+
readonly jsonDocumentUrl?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Whether Swagger UI should be served.
|
|
135
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.ui`.
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
138
|
+
readonly ui?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Whether raw OpenAPI definitions should be served.
|
|
141
|
+
* Only JSON is supported.
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
144
|
+
readonly raw?: boolean | readonly 'json'[];
|
|
145
|
+
/**
|
|
146
|
+
* Browser title for Swagger UI.
|
|
147
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.customSiteTitle`.
|
|
148
|
+
* Uses the spec's info.title if not provided.
|
|
149
|
+
*/
|
|
150
|
+
readonly customSiteTitle?: string;
|
|
151
|
+
}
|
|
91
152
|
/**
|
|
92
153
|
* Generate Swagger UI HTML page
|
|
93
154
|
*/
|
|
@@ -95,8 +156,8 @@ declare function generateSwaggerUiHtml(title: string, jsonPath: string): string;
|
|
|
95
156
|
/**
|
|
96
157
|
* Load the OpenAPI spec file from disk
|
|
97
158
|
*/
|
|
98
|
-
declare const loadSpecFileEffect: (filePath: string) => Effect.Effect<OpenApiSpec, SpecFileNotFoundError | SpecFileReadError | SpecFileParseError, never>;
|
|
99
|
-
declare function loadSpecFile(filePath: string): OpenApiSpec;
|
|
159
|
+
declare const loadSpecFileEffect: (filePath: string, options?: LoadSpecFileOptions | undefined) => Effect.Effect<OpenApiSpec, SpecFileNotFoundError | SpecFileReadError | SpecFileParseError, never>;
|
|
160
|
+
declare function loadSpecFile(filePath: string, options?: LoadSpecFileOptions): OpenApiSpec;
|
|
100
161
|
/**
|
|
101
162
|
* Resolve options with defaults
|
|
102
163
|
*/
|
|
@@ -143,6 +204,13 @@ declare class OpenApiModule {
|
|
|
143
204
|
* @returns Dynamic module configuration
|
|
144
205
|
*/
|
|
145
206
|
static forRoot(options: OpenApiModuleOptions): DynamicModule;
|
|
207
|
+
/**
|
|
208
|
+
* Register OpenAPI JSON and Swagger UI routes on an already-created Nest app.
|
|
209
|
+
*
|
|
210
|
+
* Use this when the route config depends on services that are only available
|
|
211
|
+
* during bootstrap. For module-level static config, prefer `forRoot()`.
|
|
212
|
+
*/
|
|
213
|
+
static setup(path: string, app: OpenApiHttpApplication, documentSource: OpenApiDocumentSource, options?: OpenApiSetupOptions): void;
|
|
146
214
|
}
|
|
147
215
|
|
|
148
216
|
declare const normalizePath: (path: string) => string;
|
|
@@ -163,16 +231,16 @@ declare const transformMethodEffect: (methodInfo: {
|
|
|
163
231
|
readonly scopes: readonly string[];
|
|
164
232
|
readonly schemeName: string;
|
|
165
233
|
}[];
|
|
166
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
167
234
|
readonly path: string;
|
|
235
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
168
236
|
readonly methodName: string;
|
|
169
237
|
readonly controllerName: string;
|
|
170
238
|
readonly controllerTags: readonly string[];
|
|
171
239
|
readonly returnType: {
|
|
240
|
+
readonly filePath: Option.Option<string>;
|
|
172
241
|
readonly type: Option.Option<string>;
|
|
173
242
|
readonly inline: Option.Option<string>;
|
|
174
243
|
readonly container: Option.Option<"array">;
|
|
175
|
-
readonly filePath: Option.Option<string>;
|
|
176
244
|
};
|
|
177
245
|
readonly parameters: readonly {
|
|
178
246
|
readonly name: string;
|
|
@@ -209,16 +277,16 @@ declare const transformMethodsEffect: (methodInfos: readonly {
|
|
|
209
277
|
readonly scopes: readonly string[];
|
|
210
278
|
readonly schemeName: string;
|
|
211
279
|
}[];
|
|
212
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
213
280
|
readonly path: string;
|
|
281
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
214
282
|
readonly methodName: string;
|
|
215
283
|
readonly controllerName: string;
|
|
216
284
|
readonly controllerTags: readonly string[];
|
|
217
285
|
readonly returnType: {
|
|
286
|
+
readonly filePath: Option.Option<string>;
|
|
218
287
|
readonly type: Option.Option<string>;
|
|
219
288
|
readonly inline: Option.Option<string>;
|
|
220
289
|
readonly container: Option.Option<"array">;
|
|
221
|
-
readonly filePath: Option.Option<string>;
|
|
222
290
|
};
|
|
223
291
|
readonly parameters: readonly {
|
|
224
292
|
readonly name: string;
|
|
@@ -309,7 +377,7 @@ declare const normalizeStructureRefsEffect: (schemas: GeneratedSchemas) => Effec
|
|
|
309
377
|
/**
|
|
310
378
|
* Shared service dependency graph for generation pipelines.
|
|
311
379
|
*/
|
|
312
|
-
declare const generatorServicesLayer: Layer.Layer<
|
|
380
|
+
declare const generatorServicesLayer: Layer.Layer<ProjectService | ModuleTraversalService | ConfigService | SchemaService | ValidationService | MethodExtractionService | OutputService, never, never>;
|
|
313
381
|
|
|
314
382
|
/** Handles aliased symbols (re-exports) */
|
|
315
383
|
declare const resolveClassFromSymbol: (sym: Symbol) => Option.Option<ClassDeclaration>;
|
|
@@ -329,4 +397,4 @@ interface ModuleMetadata {
|
|
|
329
397
|
declare const getModuleMetadata: (mod: ClassDeclaration) => ModuleMetadata;
|
|
330
398
|
|
|
331
399
|
export { ConfigService, GeneratedSchemas, MethodExtractionService, MethodInfo, ModuleTraversalService, OPENAPI_MODULE_OPTIONS, OPENAPI_SPEC, OpenApiModule, OpenApiPaths$1 as OpenApiPaths, OpenApiSchema, OpenApiSpec, OutputService, ProjectService, SchemaService, SpecFileNotFoundError, SpecFileParseError, SpecFileReadError, ValidationService, filterInternalSchemas, filterInternalSchemasEffect, filterSchemas, filterSchemasEffect, generateSwaggerUiHtml, generatorServicesLayer, getArrayInitializer, getControllerName, getControllerPrefix, getControllerTags, getDecoratorName, getHttpDecorator, getHttpMethods, getModuleDecoratorArg, getModuleMetadata, getStringLiteralValue, getSymbolFromIdentifier, isHttpDecorator, isHttpMethod, isModuleClass, loadSpecFile, loadSpecFileEffect, mergeGeneratedSchemas, mergeGeneratedSchemasEffect, mergeSchemas, mergeSchemasEffect, normalizePath, normalizeSchemas, normalizeSchemasEffect, normalizeStructureRefs, normalizeStructureRefsEffect, resolveArrayOfClasses, resolveClassFromExpression, resolveClassFromSymbol, resolveOptions, toPascalCase, transformMethod, transformMethodEffect, transformMethods, transformMethodsEffect };
|
|
332
|
-
export type { MergedResult, ModuleMetadata, NormalizerOptions, OpenApiModuleOptions, ResolvedOpenApiModuleOptions, SwaggerOptions };
|
|
400
|
+
export type { LoadSpecFileOptions, MergedResult, ModuleMetadata, NormalizerOptions, OpenApiDocumentFileSource, OpenApiDocumentSource, OpenApiHttpApplication, OpenApiModuleOptions, OpenApiSetupOptions, ResolvedOpenApiModuleOptions, SwaggerOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OpenApiSpec, S as SpecFileNotFoundError, a as SpecFileReadError, b as SpecFileParseError, M as MethodInfo, c as OpenApiPaths, d as OpenApiOperation, e as OpenApiPaths$1, G as GeneratedSchemas, f as OpenApiSchema,
|
|
2
|
-
export { a4 as AnalysisError, aJ as BrokenRef, aK as BrokenRefCategories, az as ClassValidationInfo, n as Config, a3 as ConfigError, X as ConfigLoadError, W as ConfigNotFoundError, Y as ConfigValidationError, o as ContactConfig, Z as DtoGlobResolutionError, U as EntryNotFoundError, E as GenerateOptions, s as GenerateOverrides, l as GenerateResult, a5 as GeneratorError, J as HttpMethod, I as InfoConfig, _ as InvalidMethodError, am as JsonSchema, L as LicenseConfig, $ as MissingGenericSchemaTempFileCleanupError, a0 as MissingGenericSchemaTempFileWriteError, ac as ModuleWithControllers, K as OpenApiGeneratorConfig, t as OpenApiOperation, u as OpenApiParameter, v as OpenApiRequestBody, w as OpenApiResponse, q as OutputFormat, F as ParameterLocation, a8 as ProjectContext, a2 as ProjectError, Q as ProjectInitError, a9 as ProjectOptions, a6 as ProjectServiceLive, ay as PropertyValidationInfo, a1 as PublicApiError, N as ResolvedConfig, R as ResolvedParameter, H as ReturnTypeInfo, ak as SchemaError, aj as SchemaGenerationError, al as SchemaGeneratorOptions, p as ServerConfig, T as TagConfig, r as TelemetryConfig, ax as ValidationConstraints, aI as ValidationResult, au as applyConstraintsToSchema, aG as categorizeBrokenRefs, m as defineConfig, as as extractClassConstraints, aq as extractClassValidationInfo, ar as extractClassValidationInfoEffect, an as extractPropertyConstraints, ap as extractPropertyValidationInfo, aA as findConfigFile, aH as formatValidationResult, k as generate, y as generateAsync, x as generateEffect, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect, ah as generateSchemas, ai as generateSchemasFromFiles, ab as getAllControllers, af as getControllerMethodInfos, ag as getControllerMethodInfosEffect, ad as getMethodInfo, ae as getMethodInfoEffect, aa as getModules, at as getRequiredProperties, ao as isPropertyOptional, aE as loadAndResolveConfig, aC as loadConfig, aB as loadConfigFromFile, a7 as makeProjectContext, av as mergeValidationConstraints, aw as mergeValidationConstraintsEffect, aD as resolveConfig, aF as validateSpec } from './shared/nestjs-openapi.
|
|
1
|
+
import { O as OpenApiSpec, S as SpecFileNotFoundError, a as SpecFileReadError, b as SpecFileParseError, M as MethodInfo, c as OpenApiPaths, d as OpenApiOperation, e as OpenApiPaths$1, G as GeneratedSchemas, f as OpenApiSchema, P as ProjectService, g as ModuleTraversalService, C as ConfigService, h as SchemaService, V as ValidationService, i as MethodExtractionService, j as OutputService } from './shared/nestjs-openapi.CAanamW0.js';
|
|
2
|
+
export { a4 as AnalysisError, aJ as BrokenRef, aK as BrokenRefCategories, az as ClassValidationInfo, n as Config, a3 as ConfigError, X as ConfigLoadError, W as ConfigNotFoundError, Y as ConfigValidationError, o as ContactConfig, Z as DtoGlobResolutionError, U as EntryNotFoundError, E as GenerateOptions, s as GenerateOverrides, l as GenerateResult, a5 as GeneratorError, J as HttpMethod, I as InfoConfig, _ as InvalidMethodError, am as JsonSchema, L as LicenseConfig, $ as MissingGenericSchemaTempFileCleanupError, a0 as MissingGenericSchemaTempFileWriteError, ac as ModuleWithControllers, K as OpenApiGeneratorConfig, t as OpenApiOperation, u as OpenApiParameter, v as OpenApiRequestBody, w as OpenApiResponse, q as OutputFormat, F as ParameterLocation, a8 as ProjectContext, a2 as ProjectError, Q as ProjectInitError, a9 as ProjectOptions, a6 as ProjectServiceLive, ay as PropertyValidationInfo, a1 as PublicApiError, N as ResolvedConfig, R as ResolvedParameter, H as ReturnTypeInfo, ak as SchemaError, aj as SchemaGenerationError, al as SchemaGeneratorOptions, p as ServerConfig, T as TagConfig, r as TelemetryConfig, ax as ValidationConstraints, aI as ValidationResult, au as applyConstraintsToSchema, aG as categorizeBrokenRefs, m as defineConfig, as as extractClassConstraints, aq as extractClassValidationInfo, ar as extractClassValidationInfoEffect, an as extractPropertyConstraints, ap as extractPropertyValidationInfo, aA as findConfigFile, aH as formatValidationResult, k as generate, y as generateAsync, x as generateEffect, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect, ah as generateSchemas, ai as generateSchemasFromFiles, ab as getAllControllers, af as getControllerMethodInfos, ag as getControllerMethodInfosEffect, ad as getMethodInfo, ae as getMethodInfoEffect, aa as getModules, at as getRequiredProperties, ao as isPropertyOptional, aE as loadAndResolveConfig, aC as loadConfig, aB as loadConfigFromFile, a7 as makeProjectContext, av as mergeValidationConstraints, aw as mergeValidationConstraintsEffect, aD as resolveConfig, aF as validateSpec } from './shared/nestjs-openapi.CAanamW0.js';
|
|
3
3
|
import { DynamicModule } from '@nestjs/common';
|
|
4
4
|
import { Effect, Option, Layer } from 'effect';
|
|
5
5
|
import { ClassDeclaration, MethodDeclaration, Decorator, Symbol, ObjectLiteralExpression, Expression } from 'ts-morph';
|
|
@@ -38,10 +38,24 @@ interface SwaggerOptions {
|
|
|
38
38
|
*/
|
|
39
39
|
readonly title?: string;
|
|
40
40
|
}
|
|
41
|
+
interface LoadSpecFileOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Additional spec files to try when the primary file is missing.
|
|
44
|
+
*/
|
|
45
|
+
readonly fallbackSpecFiles?: readonly string[];
|
|
46
|
+
}
|
|
47
|
+
interface OpenApiDocumentFileSource extends LoadSpecFileOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Path to the generated OpenAPI JSON file.
|
|
50
|
+
* Can be absolute or relative to the current working directory.
|
|
51
|
+
*/
|
|
52
|
+
readonly specFile: string;
|
|
53
|
+
}
|
|
54
|
+
type OpenApiDocumentSource = OpenApiSpec | (() => OpenApiSpec) | OpenApiDocumentFileSource;
|
|
41
55
|
/**
|
|
42
56
|
* Configuration options for the OpenAPI module
|
|
43
57
|
*/
|
|
44
|
-
interface OpenApiModuleOptions {
|
|
58
|
+
interface OpenApiModuleOptions extends LoadSpecFileOptions {
|
|
45
59
|
/**
|
|
46
60
|
* Path to the generated OpenAPI JSON file.
|
|
47
61
|
* Can be absolute or relative to the current working directory.
|
|
@@ -72,6 +86,7 @@ interface OpenApiModuleOptions {
|
|
|
72
86
|
*/
|
|
73
87
|
interface ResolvedOpenApiModuleOptions {
|
|
74
88
|
readonly specFile: string;
|
|
89
|
+
readonly fallbackSpecFiles: readonly string[];
|
|
75
90
|
readonly enabled: boolean;
|
|
76
91
|
readonly jsonPath: string;
|
|
77
92
|
readonly swagger: {
|
|
@@ -88,6 +103,52 @@ declare const OPENAPI_MODULE_OPTIONS: unique symbol;
|
|
|
88
103
|
* Injection token for the loaded OpenAPI specification
|
|
89
104
|
*/
|
|
90
105
|
declare const OPENAPI_SPEC: unique symbol;
|
|
106
|
+
interface OpenApiRouteRegistrar {
|
|
107
|
+
readonly get: (path: string, handler: (request: unknown, response: unknown) => void) => void;
|
|
108
|
+
}
|
|
109
|
+
interface OpenApiHttpApplication {
|
|
110
|
+
readonly config?: {
|
|
111
|
+
readonly getGlobalPrefix?: () => string;
|
|
112
|
+
};
|
|
113
|
+
readonly getHttpAdapter: () => OpenApiRouteRegistrar;
|
|
114
|
+
}
|
|
115
|
+
interface OpenApiSetupOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Whether OpenAPI routes should be registered.
|
|
118
|
+
* @default true
|
|
119
|
+
*/
|
|
120
|
+
readonly enabled?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Prefix OpenAPI routes with the app's `setGlobalPrefix()` value.
|
|
123
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.useGlobalPrefix`.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
readonly useGlobalPrefix?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Raw OpenAPI JSON endpoint path.
|
|
129
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.jsonDocumentUrl`.
|
|
130
|
+
* @default `${docsPath}-json`
|
|
131
|
+
*/
|
|
132
|
+
readonly jsonDocumentUrl?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Whether Swagger UI should be served.
|
|
135
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.ui`.
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
138
|
+
readonly ui?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Whether raw OpenAPI definitions should be served.
|
|
141
|
+
* Only JSON is supported.
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
144
|
+
readonly raw?: boolean | readonly 'json'[];
|
|
145
|
+
/**
|
|
146
|
+
* Browser title for Swagger UI.
|
|
147
|
+
* Matches @nestjs/swagger's `SwaggerCustomOptions.customSiteTitle`.
|
|
148
|
+
* Uses the spec's info.title if not provided.
|
|
149
|
+
*/
|
|
150
|
+
readonly customSiteTitle?: string;
|
|
151
|
+
}
|
|
91
152
|
/**
|
|
92
153
|
* Generate Swagger UI HTML page
|
|
93
154
|
*/
|
|
@@ -95,8 +156,8 @@ declare function generateSwaggerUiHtml(title: string, jsonPath: string): string;
|
|
|
95
156
|
/**
|
|
96
157
|
* Load the OpenAPI spec file from disk
|
|
97
158
|
*/
|
|
98
|
-
declare const loadSpecFileEffect: (filePath: string) => Effect.Effect<OpenApiSpec, SpecFileNotFoundError | SpecFileReadError | SpecFileParseError, never>;
|
|
99
|
-
declare function loadSpecFile(filePath: string): OpenApiSpec;
|
|
159
|
+
declare const loadSpecFileEffect: (filePath: string, options?: LoadSpecFileOptions | undefined) => Effect.Effect<OpenApiSpec, SpecFileNotFoundError | SpecFileReadError | SpecFileParseError, never>;
|
|
160
|
+
declare function loadSpecFile(filePath: string, options?: LoadSpecFileOptions): OpenApiSpec;
|
|
100
161
|
/**
|
|
101
162
|
* Resolve options with defaults
|
|
102
163
|
*/
|
|
@@ -143,6 +204,13 @@ declare class OpenApiModule {
|
|
|
143
204
|
* @returns Dynamic module configuration
|
|
144
205
|
*/
|
|
145
206
|
static forRoot(options: OpenApiModuleOptions): DynamicModule;
|
|
207
|
+
/**
|
|
208
|
+
* Register OpenAPI JSON and Swagger UI routes on an already-created Nest app.
|
|
209
|
+
*
|
|
210
|
+
* Use this when the route config depends on services that are only available
|
|
211
|
+
* during bootstrap. For module-level static config, prefer `forRoot()`.
|
|
212
|
+
*/
|
|
213
|
+
static setup(path: string, app: OpenApiHttpApplication, documentSource: OpenApiDocumentSource, options?: OpenApiSetupOptions): void;
|
|
146
214
|
}
|
|
147
215
|
|
|
148
216
|
declare const normalizePath: (path: string) => string;
|
|
@@ -163,16 +231,16 @@ declare const transformMethodEffect: (methodInfo: {
|
|
|
163
231
|
readonly scopes: readonly string[];
|
|
164
232
|
readonly schemeName: string;
|
|
165
233
|
}[];
|
|
166
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
167
234
|
readonly path: string;
|
|
235
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
168
236
|
readonly methodName: string;
|
|
169
237
|
readonly controllerName: string;
|
|
170
238
|
readonly controllerTags: readonly string[];
|
|
171
239
|
readonly returnType: {
|
|
240
|
+
readonly filePath: Option.Option<string>;
|
|
172
241
|
readonly type: Option.Option<string>;
|
|
173
242
|
readonly inline: Option.Option<string>;
|
|
174
243
|
readonly container: Option.Option<"array">;
|
|
175
|
-
readonly filePath: Option.Option<string>;
|
|
176
244
|
};
|
|
177
245
|
readonly parameters: readonly {
|
|
178
246
|
readonly name: string;
|
|
@@ -209,16 +277,16 @@ declare const transformMethodsEffect: (methodInfos: readonly {
|
|
|
209
277
|
readonly scopes: readonly string[];
|
|
210
278
|
readonly schemeName: string;
|
|
211
279
|
}[];
|
|
212
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
213
280
|
readonly path: string;
|
|
281
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
214
282
|
readonly methodName: string;
|
|
215
283
|
readonly controllerName: string;
|
|
216
284
|
readonly controllerTags: readonly string[];
|
|
217
285
|
readonly returnType: {
|
|
286
|
+
readonly filePath: Option.Option<string>;
|
|
218
287
|
readonly type: Option.Option<string>;
|
|
219
288
|
readonly inline: Option.Option<string>;
|
|
220
289
|
readonly container: Option.Option<"array">;
|
|
221
|
-
readonly filePath: Option.Option<string>;
|
|
222
290
|
};
|
|
223
291
|
readonly parameters: readonly {
|
|
224
292
|
readonly name: string;
|
|
@@ -309,7 +377,7 @@ declare const normalizeStructureRefsEffect: (schemas: GeneratedSchemas) => Effec
|
|
|
309
377
|
/**
|
|
310
378
|
* Shared service dependency graph for generation pipelines.
|
|
311
379
|
*/
|
|
312
|
-
declare const generatorServicesLayer: Layer.Layer<
|
|
380
|
+
declare const generatorServicesLayer: Layer.Layer<ProjectService | ModuleTraversalService | ConfigService | SchemaService | ValidationService | MethodExtractionService | OutputService, never, never>;
|
|
313
381
|
|
|
314
382
|
/** Handles aliased symbols (re-exports) */
|
|
315
383
|
declare const resolveClassFromSymbol: (sym: Symbol) => Option.Option<ClassDeclaration>;
|
|
@@ -329,4 +397,4 @@ interface ModuleMetadata {
|
|
|
329
397
|
declare const getModuleMetadata: (mod: ClassDeclaration) => ModuleMetadata;
|
|
330
398
|
|
|
331
399
|
export { ConfigService, GeneratedSchemas, MethodExtractionService, MethodInfo, ModuleTraversalService, OPENAPI_MODULE_OPTIONS, OPENAPI_SPEC, OpenApiModule, OpenApiPaths$1 as OpenApiPaths, OpenApiSchema, OpenApiSpec, OutputService, ProjectService, SchemaService, SpecFileNotFoundError, SpecFileParseError, SpecFileReadError, ValidationService, filterInternalSchemas, filterInternalSchemasEffect, filterSchemas, filterSchemasEffect, generateSwaggerUiHtml, generatorServicesLayer, getArrayInitializer, getControllerName, getControllerPrefix, getControllerTags, getDecoratorName, getHttpDecorator, getHttpMethods, getModuleDecoratorArg, getModuleMetadata, getStringLiteralValue, getSymbolFromIdentifier, isHttpDecorator, isHttpMethod, isModuleClass, loadSpecFile, loadSpecFileEffect, mergeGeneratedSchemas, mergeGeneratedSchemasEffect, mergeSchemas, mergeSchemasEffect, normalizePath, normalizeSchemas, normalizeSchemasEffect, normalizeStructureRefs, normalizeStructureRefsEffect, resolveArrayOfClasses, resolveClassFromExpression, resolveClassFromSymbol, resolveOptions, toPascalCase, transformMethod, transformMethodEffect, transformMethods, transformMethodsEffect };
|
|
332
|
-
export type { MergedResult, ModuleMetadata, NormalizerOptions, OpenApiModuleOptions, ResolvedOpenApiModuleOptions, SwaggerOptions };
|
|
400
|
+
export type { LoadSpecFileOptions, MergedResult, ModuleMetadata, NormalizerOptions, OpenApiDocumentFileSource, OpenApiDocumentSource, OpenApiHttpApplication, OpenApiModuleOptions, OpenApiSetupOptions, ResolvedOpenApiModuleOptions, SwaggerOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as SpecFileNotFoundError, a as
|
|
2
|
-
export { c as ConfigLoadError, C as ConfigNotFoundError, ae as ConfigService, e as ConfigValidationError, D as DtoGlobResolutionError, E as EntryNotFoundError, I as InvalidMethodError, B as MethodExtractionService, M as MissingGenericSchemaTempFileCleanupError, f as MissingGenericSchemaTempFileWriteError, n as ModuleTraversalService, ad as OutputService, P as ProjectInitError, i as ProjectService, j as ProjectServiceLive, h as PublicApiError, a0 as SchemaGenerationError, a1 as SchemaService, ac as ValidationService, a9 as applyConstraintsToSchema, av as categorizeBrokenRefs, d as defineConfig, a7 as extractClassConstraints, a5 as extractClassValidationInfo, a6 as extractClassValidationInfoEffect, a2 as extractPropertyConstraints, a4 as extractPropertyValidationInfo, V as filterInternalSchemas, W as filterInternalSchemasEffect, Q as filterSchemas, R as filterSchemasEffect, af as findConfigFile, aw as formatValidationResult, g as generate, _ as generateSchemas, $ as generateSchemasFromFiles, ak as generatorServicesLayer, l as getAllControllers, am as getArrayInitializer, z as getControllerMethodInfos, A as getControllerMethodInfosEffect, p as getControllerName, o as getControllerPrefix, t as getControllerTags, s as getDecoratorName, u as getHttpDecorator, r as getHttpMethods, x as getMethodInfo, y as getMethodInfoEffect, aq as getModuleDecoratorArg, at as getModuleMetadata, k as getModules, a8 as getRequiredProperties, an as getStringLiteralValue, ao as getSymbolFromIdentifier, v as isHttpDecorator, q as isHttpMethod, ap as isModuleClass, a3 as isPropertyOptional, aj as loadAndResolveConfig, ah as loadConfig, ag as loadConfigFromFile, m as makeProjectContext, N as mergeGeneratedSchemas, O as mergeGeneratedSchemasEffect, K as mergeSchemas, L as mergeSchemasEffect, aa as mergeValidationConstraints, ab as mergeValidationConstraintsEffect, w as normalizePath, T as normalizeSchemas, U as normalizeSchemasEffect, X as normalizeStructureRefs, Y as normalizeStructureRefsEffect, as as resolveArrayOfClasses, ar as resolveClassFromExpression, al as resolveClassFromSymbol, ai as resolveConfig, Z as toPascalCase, F as transformMethod, G as transformMethodEffect, H as transformMethods, J as transformMethodsEffect, au as validateSpec } from './shared/nestjs-openapi.
|
|
1
|
+
import { S as SpecFileNotFoundError, a as SpecFileParseError, b as SpecFileReadError } from './shared/nestjs-openapi.Nd-wGr8A.mjs';
|
|
2
|
+
export { c as ConfigLoadError, C as ConfigNotFoundError, ae as ConfigService, e as ConfigValidationError, D as DtoGlobResolutionError, E as EntryNotFoundError, I as InvalidMethodError, B as MethodExtractionService, M as MissingGenericSchemaTempFileCleanupError, f as MissingGenericSchemaTempFileWriteError, n as ModuleTraversalService, ad as OutputService, P as ProjectInitError, i as ProjectService, j as ProjectServiceLive, h as PublicApiError, a0 as SchemaGenerationError, a1 as SchemaService, ac as ValidationService, a9 as applyConstraintsToSchema, av as categorizeBrokenRefs, d as defineConfig, a7 as extractClassConstraints, a5 as extractClassValidationInfo, a6 as extractClassValidationInfoEffect, a2 as extractPropertyConstraints, a4 as extractPropertyValidationInfo, V as filterInternalSchemas, W as filterInternalSchemasEffect, Q as filterSchemas, R as filterSchemasEffect, af as findConfigFile, aw as formatValidationResult, g as generate, _ as generateSchemas, $ as generateSchemasFromFiles, ak as generatorServicesLayer, l as getAllControllers, am as getArrayInitializer, z as getControllerMethodInfos, A as getControllerMethodInfosEffect, p as getControllerName, o as getControllerPrefix, t as getControllerTags, s as getDecoratorName, u as getHttpDecorator, r as getHttpMethods, x as getMethodInfo, y as getMethodInfoEffect, aq as getModuleDecoratorArg, at as getModuleMetadata, k as getModules, a8 as getRequiredProperties, an as getStringLiteralValue, ao as getSymbolFromIdentifier, v as isHttpDecorator, q as isHttpMethod, ap as isModuleClass, a3 as isPropertyOptional, aj as loadAndResolveConfig, ah as loadConfig, ag as loadConfigFromFile, m as makeProjectContext, N as mergeGeneratedSchemas, O as mergeGeneratedSchemasEffect, K as mergeSchemas, L as mergeSchemasEffect, aa as mergeValidationConstraints, ab as mergeValidationConstraintsEffect, w as normalizePath, T as normalizeSchemas, U as normalizeSchemasEffect, X as normalizeStructureRefs, Y as normalizeStructureRefsEffect, as as resolveArrayOfClasses, ar as resolveClassFromExpression, al as resolveClassFromSymbol, ai as resolveConfig, Z as toPascalCase, F as transformMethod, G as transformMethodEffect, H as transformMethods, J as transformMethodsEffect, au as validateSpec } from './shared/nestjs-openapi.Nd-wGr8A.mjs';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
4
|
import { fail } from 'node:assert';
|
|
5
5
|
import { resolve } from 'node:path';
|
|
6
6
|
import { Module } from '@nestjs/common';
|
|
7
|
-
import { Effect, Exit, Cause, Option } from 'effect';
|
|
7
|
+
import { Effect, Either, Exit, Cause, Option } from 'effect';
|
|
8
8
|
export { generateAsync, generate as generateEffect, generateFromConfigAsync, generateFromConfigEffect, generatePathsAsync, generatePathsEffect } from './internal.mjs';
|
|
9
9
|
import 'node:crypto';
|
|
10
10
|
import 'ts-morph';
|
|
@@ -94,21 +94,40 @@ function generateSwaggerUiHtml(title, jsonPath) {
|
|
|
94
94
|
</body>
|
|
95
95
|
</html>`;
|
|
96
96
|
}
|
|
97
|
+
function isErrorWithCode(cause, code) {
|
|
98
|
+
return cause !== null && typeof cause === "object" && "code" in cause && cause.code === code;
|
|
99
|
+
}
|
|
100
|
+
function getSpecFileCandidates(filePath, options = {}) {
|
|
101
|
+
const candidates = [filePath];
|
|
102
|
+
candidates.push(...options.fallbackSpecFiles ?? []);
|
|
103
|
+
return [...new Set(candidates)];
|
|
104
|
+
}
|
|
105
|
+
const readSpecFileContentEffect = (filePath) => Effect.try({
|
|
106
|
+
try: () => readFileSync(resolve(process.cwd(), filePath), "utf-8"),
|
|
107
|
+
catch: (cause) => isErrorWithCode(cause, "ENOENT") ? SpecFileNotFoundError.create(filePath) : SpecFileReadError.create(filePath, cause)
|
|
108
|
+
});
|
|
97
109
|
const loadSpecFileEffect = Effect.fn("OpenApiModule.loadSpecFile")(
|
|
98
|
-
function* (filePath) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
function* (filePath, options = {}) {
|
|
111
|
+
for (const candidate of getSpecFileCandidates(filePath, options)) {
|
|
112
|
+
const contentResult = yield* readSpecFileContentEffect(candidate).pipe(
|
|
113
|
+
Effect.either
|
|
114
|
+
);
|
|
115
|
+
if (Either.isLeft(contentResult)) {
|
|
116
|
+
if (contentResult.left instanceof SpecFileNotFoundError) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
return yield* Effect.fail(contentResult.left);
|
|
120
|
+
}
|
|
121
|
+
return yield* Effect.try({
|
|
122
|
+
try: () => JSON.parse(contentResult.right),
|
|
123
|
+
catch: (cause) => SpecFileParseError.create(candidate, cause)
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return yield* Effect.fail(SpecFileNotFoundError.create(filePath));
|
|
108
127
|
}
|
|
109
128
|
);
|
|
110
|
-
function loadSpecFile(filePath) {
|
|
111
|
-
const exit = Effect.runSyncExit(loadSpecFileEffect(filePath));
|
|
129
|
+
function loadSpecFile(filePath, options = {}) {
|
|
130
|
+
const exit = Effect.runSyncExit(loadSpecFileEffect(filePath, options));
|
|
112
131
|
if (Exit.isSuccess(exit)) {
|
|
113
132
|
return exit.value;
|
|
114
133
|
}
|
|
@@ -131,6 +150,7 @@ function resolveOptions(options) {
|
|
|
131
150
|
}
|
|
132
151
|
return {
|
|
133
152
|
specFile: options.specFile,
|
|
153
|
+
fallbackSpecFiles: options.fallbackSpecFiles ?? [],
|
|
134
154
|
enabled: options.enabled ?? true,
|
|
135
155
|
jsonPath: options.jsonPath ?? "/openapi.json",
|
|
136
156
|
swagger: {
|
|
@@ -140,6 +160,26 @@ function resolveOptions(options) {
|
|
|
140
160
|
}
|
|
141
161
|
};
|
|
142
162
|
}
|
|
163
|
+
function resolveOptionsWithSpecTitle(options, spec) {
|
|
164
|
+
return {
|
|
165
|
+
...options,
|
|
166
|
+
swagger: {
|
|
167
|
+
...options.swagger,
|
|
168
|
+
title: options.swagger.title || spec.info.title
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function createOpenApiModuleState(options) {
|
|
173
|
+
const resolvedOptions = resolveOptions(options);
|
|
174
|
+
if (!resolvedOptions.enabled) {
|
|
175
|
+
return { options: resolvedOptions };
|
|
176
|
+
}
|
|
177
|
+
const spec = loadSpecFile(resolvedOptions.specFile, resolvedOptions);
|
|
178
|
+
return {
|
|
179
|
+
spec,
|
|
180
|
+
options: resolveOptionsWithSpecTitle(resolvedOptions, spec)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
143
183
|
_OpenApiModule_decorators = [Module({})];
|
|
144
184
|
let _OpenApiModule = class _OpenApiModule {
|
|
145
185
|
/**
|
|
@@ -149,8 +189,8 @@ let _OpenApiModule = class _OpenApiModule {
|
|
|
149
189
|
* @returns Dynamic module configuration
|
|
150
190
|
*/
|
|
151
191
|
static forRoot(options) {
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
192
|
+
const state = createOpenApiModuleState(options);
|
|
193
|
+
if (!state.options.enabled || !state.spec) {
|
|
154
194
|
return {
|
|
155
195
|
module: _OpenApiModule,
|
|
156
196
|
providers: [],
|
|
@@ -158,25 +198,17 @@ let _OpenApiModule = class _OpenApiModule {
|
|
|
158
198
|
exports: []
|
|
159
199
|
};
|
|
160
200
|
}
|
|
161
|
-
const spec = loadSpecFile(resolvedOptions.specFile);
|
|
162
|
-
const finalOptions = {
|
|
163
|
-
...resolvedOptions,
|
|
164
|
-
swagger: {
|
|
165
|
-
...resolvedOptions.swagger,
|
|
166
|
-
title: resolvedOptions.swagger.title || spec.info.title
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
201
|
const providers = [
|
|
170
202
|
{
|
|
171
203
|
provide: OPENAPI_MODULE_OPTIONS,
|
|
172
|
-
useValue:
|
|
204
|
+
useValue: state.options
|
|
173
205
|
},
|
|
174
206
|
{
|
|
175
207
|
provide: OPENAPI_SPEC,
|
|
176
|
-
useValue: spec
|
|
208
|
+
useValue: state.spec
|
|
177
209
|
}
|
|
178
210
|
];
|
|
179
|
-
const controllers = createOpenApiControllers(
|
|
211
|
+
const controllers = createOpenApiControllers(state.options, state.spec);
|
|
180
212
|
return {
|
|
181
213
|
module: _OpenApiModule,
|
|
182
214
|
providers,
|
|
@@ -184,11 +216,97 @@ let _OpenApiModule = class _OpenApiModule {
|
|
|
184
216
|
exports: [OPENAPI_MODULE_OPTIONS, OPENAPI_SPEC]
|
|
185
217
|
};
|
|
186
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Register OpenAPI JSON and Swagger UI routes on an already-created Nest app.
|
|
221
|
+
*
|
|
222
|
+
* Use this when the route config depends on services that are only available
|
|
223
|
+
* during bootstrap. For module-level static config, prefer `forRoot()`.
|
|
224
|
+
*/
|
|
225
|
+
static setup(path, app, documentSource, options = {}) {
|
|
226
|
+
if (options.enabled === false) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const spec = loadDocumentSource(documentSource);
|
|
230
|
+
const httpAdapter = app.getHttpAdapter();
|
|
231
|
+
const swaggerPath = resolveSetupPath(path, app, options);
|
|
232
|
+
const jsonPath = resolveJsonDocumentUrl(swaggerPath, app, options);
|
|
233
|
+
if (shouldServeJson(options.raw)) {
|
|
234
|
+
httpAdapter.get(jsonPath, (_request, response) => {
|
|
235
|
+
sendResponse(response, spec, "application/json");
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (options.ui !== false) {
|
|
239
|
+
httpAdapter.get(swaggerPath, (_request, response) => {
|
|
240
|
+
sendResponse(
|
|
241
|
+
response,
|
|
242
|
+
generateSwaggerUiHtml(
|
|
243
|
+
options.customSiteTitle ?? spec.info.title,
|
|
244
|
+
jsonPath
|
|
245
|
+
),
|
|
246
|
+
"text/html"
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
187
251
|
};
|
|
188
252
|
_init = __decoratorStart();
|
|
189
253
|
_OpenApiModule = __decorateElement(_init, 0, "OpenApiModule", _OpenApiModule_decorators, _OpenApiModule);
|
|
190
254
|
__runInitializers(_init, 1, _OpenApiModule);
|
|
191
255
|
let OpenApiModule = _OpenApiModule;
|
|
256
|
+
function loadDocumentSource(source) {
|
|
257
|
+
if (typeof source === "function") {
|
|
258
|
+
return source();
|
|
259
|
+
}
|
|
260
|
+
if (isDocumentFileSource(source)) {
|
|
261
|
+
return loadSpecFile(source.specFile, source);
|
|
262
|
+
}
|
|
263
|
+
return source;
|
|
264
|
+
}
|
|
265
|
+
function isDocumentFileSource(source) {
|
|
266
|
+
return source !== null && typeof source === "object" && "specFile" in source && typeof source.specFile === "string";
|
|
267
|
+
}
|
|
268
|
+
function resolveSetupPath(path, app, options) {
|
|
269
|
+
return joinRoutePath(
|
|
270
|
+
options.useGlobalPrefix === true ? getGlobalPrefix(app) : void 0,
|
|
271
|
+
path
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
function resolveJsonDocumentUrl(finalSwaggerPath, app, options) {
|
|
275
|
+
if (!options.jsonDocumentUrl) {
|
|
276
|
+
return `${finalSwaggerPath}-json`;
|
|
277
|
+
}
|
|
278
|
+
return joinRoutePath(
|
|
279
|
+
options.useGlobalPrefix === true ? getGlobalPrefix(app) : void 0,
|
|
280
|
+
options.jsonDocumentUrl
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
function getGlobalPrefix(app) {
|
|
284
|
+
const appWithConfig = app;
|
|
285
|
+
return appWithConfig.config?.getGlobalPrefix?.() ?? "";
|
|
286
|
+
}
|
|
287
|
+
function shouldServeJson(raw) {
|
|
288
|
+
return raw === void 0 || raw === true || Array.isArray(raw) && raw.length > 0;
|
|
289
|
+
}
|
|
290
|
+
function joinRoutePath(...parts) {
|
|
291
|
+
return `/${parts.filter((part) => part !== void 0 && part !== "").map((part) => part.replace(/^\/+|\/+$/g, "")).filter((part) => part.length > 0).join("/")}`;
|
|
292
|
+
}
|
|
293
|
+
function sendResponse(response, body, contentType) {
|
|
294
|
+
const responseLike = response;
|
|
295
|
+
responseLike.setHeader?.("Content-Type", contentType);
|
|
296
|
+
if (contentType === "application/json" && responseLike.json) {
|
|
297
|
+
responseLike.json(body);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (responseLike.type && responseLike.send) {
|
|
301
|
+
responseLike.type(contentType).send(body);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (responseLike.send) {
|
|
305
|
+
responseLike.send(body);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
responseLike.end?.(typeof body === "string" ? body : JSON.stringify(body));
|
|
309
|
+
}
|
|
192
310
|
function createJsonController(controllerPath, spec) {
|
|
193
311
|
class JsonSpecController {
|
|
194
312
|
getSpec() {
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { E as GenerateOptions, x as generate, y as generateAsync, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect } from './shared/nestjs-openapi.
|
|
1
|
+
export { E as GenerateOptions, x as generate, y as generateAsync, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect } from './shared/nestjs-openapi.CAanamW0.mjs';
|
|
2
2
|
import 'effect';
|
|
3
3
|
import 'ts-morph';
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { E as GenerateOptions, x as generate, y as generateAsync, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect } from './shared/nestjs-openapi.
|
|
1
|
+
export { E as GenerateOptions, x as generate, y as generateAsync, D as generateFromConfigAsync, B as generateFromConfigEffect, A as generatePathsAsync, z as generatePathsEffect } from './shared/nestjs-openapi.CAanamW0.js';
|
|
2
2
|
import 'effect';
|
|
3
3
|
import 'ts-morph';
|
package/dist/internal.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import { i as ProjectService, n as ModuleTraversalService, B as MethodExtractionService, J as transformMethodsEffect, ax as generateEffect, ay as runProjectApiPromise, ak as generatorServicesLayer, az as runtimeLayerFor, aA as runGeneratorApiPromise } from './shared/nestjs-openapi.
|
|
2
|
+
import { i as ProjectService, n as ModuleTraversalService, B as MethodExtractionService, J as transformMethodsEffect, ax as generateEffect, ay as runProjectApiPromise, ak as generatorServicesLayer, az as runtimeLayerFor, aA as runGeneratorApiPromise } from './shared/nestjs-openapi.Nd-wGr8A.mjs';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'node:crypto';
|
|
@@ -1145,16 +1145,16 @@ declare const getMethodInfoEffect: (controller: ClassDeclaration, method: Method
|
|
|
1145
1145
|
readonly scopes: readonly string[];
|
|
1146
1146
|
readonly schemeName: string;
|
|
1147
1147
|
}[];
|
|
1148
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1149
1148
|
readonly path: string;
|
|
1149
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1150
1150
|
readonly methodName: string;
|
|
1151
1151
|
readonly controllerName: string;
|
|
1152
1152
|
readonly controllerTags: readonly string[];
|
|
1153
1153
|
readonly returnType: {
|
|
1154
|
+
readonly filePath: Option.Option<string>;
|
|
1154
1155
|
readonly type: Option.Option<string>;
|
|
1155
1156
|
readonly inline: Option.Option<string>;
|
|
1156
1157
|
readonly container: Option.Option<"array">;
|
|
1157
|
-
readonly filePath: Option.Option<string>;
|
|
1158
1158
|
};
|
|
1159
1159
|
readonly parameters: readonly {
|
|
1160
1160
|
readonly name: string;
|
|
@@ -1186,16 +1186,16 @@ declare const getControllerMethodInfosEffect: (controller: ClassDeclaration, opt
|
|
|
1186
1186
|
readonly scopes: readonly string[];
|
|
1187
1187
|
readonly schemeName: string;
|
|
1188
1188
|
}[];
|
|
1189
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1190
1189
|
readonly path: string;
|
|
1190
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1191
1191
|
readonly methodName: string;
|
|
1192
1192
|
readonly controllerName: string;
|
|
1193
1193
|
readonly controllerTags: readonly string[];
|
|
1194
1194
|
readonly returnType: {
|
|
1195
|
+
readonly filePath: Option.Option<string>;
|
|
1195
1196
|
readonly type: Option.Option<string>;
|
|
1196
1197
|
readonly inline: Option.Option<string>;
|
|
1197
1198
|
readonly container: Option.Option<"array">;
|
|
1198
|
-
readonly filePath: Option.Option<string>;
|
|
1199
1199
|
};
|
|
1200
1200
|
readonly parameters: readonly {
|
|
1201
1201
|
readonly name: string;
|
|
@@ -1229,16 +1229,16 @@ declare const MethodExtractionService_base: Effect.Service.Class<MethodExtractio
|
|
|
1229
1229
|
readonly scopes: readonly string[];
|
|
1230
1230
|
readonly schemeName: string;
|
|
1231
1231
|
}[];
|
|
1232
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1233
1232
|
readonly path: string;
|
|
1233
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1234
1234
|
readonly methodName: string;
|
|
1235
1235
|
readonly controllerName: string;
|
|
1236
1236
|
readonly controllerTags: readonly string[];
|
|
1237
1237
|
readonly returnType: {
|
|
1238
|
+
readonly filePath: Option.Option<string>;
|
|
1238
1239
|
readonly type: Option.Option<string>;
|
|
1239
1240
|
readonly inline: Option.Option<string>;
|
|
1240
1241
|
readonly container: Option.Option<"array">;
|
|
1241
|
-
readonly filePath: Option.Option<string>;
|
|
1242
1242
|
};
|
|
1243
1243
|
readonly parameters: readonly {
|
|
1244
1244
|
readonly name: string;
|
|
@@ -1269,16 +1269,16 @@ declare const MethodExtractionService_base: Effect.Service.Class<MethodExtractio
|
|
|
1269
1269
|
readonly scopes: readonly string[];
|
|
1270
1270
|
readonly schemeName: string;
|
|
1271
1271
|
}[];
|
|
1272
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1273
1272
|
readonly path: string;
|
|
1273
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1274
1274
|
readonly methodName: string;
|
|
1275
1275
|
readonly controllerName: string;
|
|
1276
1276
|
readonly controllerTags: readonly string[];
|
|
1277
1277
|
readonly returnType: {
|
|
1278
|
+
readonly filePath: Option.Option<string>;
|
|
1278
1279
|
readonly type: Option.Option<string>;
|
|
1279
1280
|
readonly inline: Option.Option<string>;
|
|
1280
1281
|
readonly container: Option.Option<"array">;
|
|
1281
|
-
readonly filePath: Option.Option<string>;
|
|
1282
1282
|
};
|
|
1283
1283
|
readonly parameters: readonly {
|
|
1284
1284
|
readonly name: string;
|
|
@@ -1332,18 +1332,7 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1332
1332
|
readonly effect: Effect.Effect<{
|
|
1333
1333
|
findConfigFile: (startDir?: string | undefined) => Effect.Effect<string, ConfigNotFoundError, never>;
|
|
1334
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
1335
|
readonly openapi: {
|
|
1346
|
-
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1347
1336
|
readonly info: {
|
|
1348
1337
|
readonly version: string;
|
|
1349
1338
|
readonly title: string;
|
|
@@ -1427,7 +1416,18 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1427
1416
|
readonly [x: string]: readonly string[];
|
|
1428
1417
|
}[] | undefined;
|
|
1429
1418
|
} | undefined;
|
|
1419
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1430
1420
|
};
|
|
1421
|
+
readonly extends?: string | undefined;
|
|
1422
|
+
readonly files?: {
|
|
1423
|
+
readonly tsconfig?: string | undefined;
|
|
1424
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1425
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1426
|
+
readonly include?: readonly string[] | undefined;
|
|
1427
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1428
|
+
} | undefined;
|
|
1429
|
+
readonly output: string;
|
|
1430
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1431
1431
|
readonly options?: {
|
|
1432
1432
|
readonly query?: {
|
|
1433
1433
|
readonly style?: "inline" | "ref" | undefined;
|
|
@@ -1442,18 +1442,7 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1442
1442
|
} | undefined;
|
|
1443
1443
|
}, ConfigError, never>;
|
|
1444
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
1445
|
readonly openapi: {
|
|
1456
|
-
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1457
1446
|
readonly info: {
|
|
1458
1447
|
readonly version: string;
|
|
1459
1448
|
readonly title: string;
|
|
@@ -1537,7 +1526,18 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1537
1526
|
readonly [x: string]: readonly string[];
|
|
1538
1527
|
}[] | undefined;
|
|
1539
1528
|
} | undefined;
|
|
1529
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1540
1530
|
};
|
|
1531
|
+
readonly extends?: string | undefined;
|
|
1532
|
+
readonly files?: {
|
|
1533
|
+
readonly tsconfig?: string | undefined;
|
|
1534
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1535
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1536
|
+
readonly include?: readonly string[] | undefined;
|
|
1537
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1538
|
+
} | undefined;
|
|
1539
|
+
readonly output: string;
|
|
1540
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1541
1541
|
readonly options?: {
|
|
1542
1542
|
readonly query?: {
|
|
1543
1543
|
readonly style?: "inline" | "ref" | undefined;
|
|
@@ -1552,18 +1552,7 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1552
1552
|
} | undefined;
|
|
1553
1553
|
}, ConfigError, never>;
|
|
1554
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
1555
|
readonly openapi: {
|
|
1566
|
-
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1567
1556
|
readonly info: {
|
|
1568
1557
|
readonly version: string;
|
|
1569
1558
|
readonly title: string;
|
|
@@ -1647,7 +1636,18 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1647
1636
|
readonly [x: string]: readonly string[];
|
|
1648
1637
|
}[] | undefined;
|
|
1649
1638
|
} | undefined;
|
|
1639
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1650
1640
|
};
|
|
1641
|
+
readonly extends?: string | undefined;
|
|
1642
|
+
readonly files?: {
|
|
1643
|
+
readonly tsconfig?: string | undefined;
|
|
1644
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1645
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1646
|
+
readonly include?: readonly string[] | undefined;
|
|
1647
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1648
|
+
} | undefined;
|
|
1649
|
+
readonly output: string;
|
|
1650
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1651
1651
|
readonly options?: {
|
|
1652
1652
|
readonly query?: {
|
|
1653
1653
|
readonly style?: "inline" | "ref" | undefined;
|
|
@@ -1661,14 +1661,6 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1661
1661
|
readonly pathFilter?: RegExp | ((path: string) => boolean) | undefined;
|
|
1662
1662
|
} | undefined;
|
|
1663
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
1664
|
readonly info: {
|
|
1673
1665
|
readonly version: string;
|
|
1674
1666
|
readonly title: string;
|
|
@@ -1691,6 +1683,14 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1691
1683
|
readonly name: string;
|
|
1692
1684
|
readonly description?: string | undefined;
|
|
1693
1685
|
}[];
|
|
1686
|
+
readonly tsconfig: string;
|
|
1687
|
+
readonly entry: readonly string[];
|
|
1688
|
+
readonly dtoGlob: readonly string[];
|
|
1689
|
+
readonly include: readonly string[];
|
|
1690
|
+
readonly exclude: readonly string[];
|
|
1691
|
+
readonly output: string;
|
|
1692
|
+
readonly format: "json" | "yaml";
|
|
1693
|
+
readonly version?: string | undefined;
|
|
1694
1694
|
readonly basePath?: string | undefined;
|
|
1695
1695
|
readonly extractValidation: boolean;
|
|
1696
1696
|
readonly excludeDecorators: readonly string[];
|
|
@@ -1757,14 +1757,6 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1757
1757
|
}[];
|
|
1758
1758
|
}, ConfigValidationError, never>;
|
|
1759
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
1760
|
readonly info: {
|
|
1769
1761
|
readonly version: string;
|
|
1770
1762
|
readonly title: string;
|
|
@@ -1787,6 +1779,14 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1787
1779
|
readonly name: string;
|
|
1788
1780
|
readonly description?: string | undefined;
|
|
1789
1781
|
}[];
|
|
1782
|
+
readonly tsconfig: string;
|
|
1783
|
+
readonly entry: readonly string[];
|
|
1784
|
+
readonly dtoGlob: readonly string[];
|
|
1785
|
+
readonly include: readonly string[];
|
|
1786
|
+
readonly exclude: readonly string[];
|
|
1787
|
+
readonly output: string;
|
|
1788
|
+
readonly format: "json" | "yaml";
|
|
1789
|
+
readonly version?: string | undefined;
|
|
1790
1790
|
readonly basePath?: string | undefined;
|
|
1791
1791
|
readonly extractValidation: boolean;
|
|
1792
1792
|
readonly excludeDecorators: readonly string[];
|
|
@@ -2271,5 +2271,5 @@ declare const generate: (options: GenerateOptions) => Effect.Effect<{
|
|
|
2271
2271
|
}, ProjectInitError | EntryNotFoundError, ModuleTraversalService | ProjectService | MethodExtractionService>;
|
|
2272
2272
|
declare const generateAsync: (options: GenerateOptions) => Promise<OpenApiPaths>;
|
|
2273
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,
|
|
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, SchemaService as h, MethodExtractionService as i, OutputService as j, generate$1 as k, defineConfig as m, generate as x, generateAsync as y, generatePathsEffect as z };
|
|
2275
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 };
|
|
@@ -1145,16 +1145,16 @@ declare const getMethodInfoEffect: (controller: ClassDeclaration, method: Method
|
|
|
1145
1145
|
readonly scopes: readonly string[];
|
|
1146
1146
|
readonly schemeName: string;
|
|
1147
1147
|
}[];
|
|
1148
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1149
1148
|
readonly path: string;
|
|
1149
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1150
1150
|
readonly methodName: string;
|
|
1151
1151
|
readonly controllerName: string;
|
|
1152
1152
|
readonly controllerTags: readonly string[];
|
|
1153
1153
|
readonly returnType: {
|
|
1154
|
+
readonly filePath: Option.Option<string>;
|
|
1154
1155
|
readonly type: Option.Option<string>;
|
|
1155
1156
|
readonly inline: Option.Option<string>;
|
|
1156
1157
|
readonly container: Option.Option<"array">;
|
|
1157
|
-
readonly filePath: Option.Option<string>;
|
|
1158
1158
|
};
|
|
1159
1159
|
readonly parameters: readonly {
|
|
1160
1160
|
readonly name: string;
|
|
@@ -1186,16 +1186,16 @@ declare const getControllerMethodInfosEffect: (controller: ClassDeclaration, opt
|
|
|
1186
1186
|
readonly scopes: readonly string[];
|
|
1187
1187
|
readonly schemeName: string;
|
|
1188
1188
|
}[];
|
|
1189
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1190
1189
|
readonly path: string;
|
|
1190
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1191
1191
|
readonly methodName: string;
|
|
1192
1192
|
readonly controllerName: string;
|
|
1193
1193
|
readonly controllerTags: readonly string[];
|
|
1194
1194
|
readonly returnType: {
|
|
1195
|
+
readonly filePath: Option.Option<string>;
|
|
1195
1196
|
readonly type: Option.Option<string>;
|
|
1196
1197
|
readonly inline: Option.Option<string>;
|
|
1197
1198
|
readonly container: Option.Option<"array">;
|
|
1198
|
-
readonly filePath: Option.Option<string>;
|
|
1199
1199
|
};
|
|
1200
1200
|
readonly parameters: readonly {
|
|
1201
1201
|
readonly name: string;
|
|
@@ -1229,16 +1229,16 @@ declare const MethodExtractionService_base: Effect.Service.Class<MethodExtractio
|
|
|
1229
1229
|
readonly scopes: readonly string[];
|
|
1230
1230
|
readonly schemeName: string;
|
|
1231
1231
|
}[];
|
|
1232
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1233
1232
|
readonly path: string;
|
|
1233
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1234
1234
|
readonly methodName: string;
|
|
1235
1235
|
readonly controllerName: string;
|
|
1236
1236
|
readonly controllerTags: readonly string[];
|
|
1237
1237
|
readonly returnType: {
|
|
1238
|
+
readonly filePath: Option.Option<string>;
|
|
1238
1239
|
readonly type: Option.Option<string>;
|
|
1239
1240
|
readonly inline: Option.Option<string>;
|
|
1240
1241
|
readonly container: Option.Option<"array">;
|
|
1241
|
-
readonly filePath: Option.Option<string>;
|
|
1242
1242
|
};
|
|
1243
1243
|
readonly parameters: readonly {
|
|
1244
1244
|
readonly name: string;
|
|
@@ -1269,16 +1269,16 @@ declare const MethodExtractionService_base: Effect.Service.Class<MethodExtractio
|
|
|
1269
1269
|
readonly scopes: readonly string[];
|
|
1270
1270
|
readonly schemeName: string;
|
|
1271
1271
|
}[];
|
|
1272
|
-
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1273
1272
|
readonly path: string;
|
|
1273
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" | "ALL";
|
|
1274
1274
|
readonly methodName: string;
|
|
1275
1275
|
readonly controllerName: string;
|
|
1276
1276
|
readonly controllerTags: readonly string[];
|
|
1277
1277
|
readonly returnType: {
|
|
1278
|
+
readonly filePath: Option.Option<string>;
|
|
1278
1279
|
readonly type: Option.Option<string>;
|
|
1279
1280
|
readonly inline: Option.Option<string>;
|
|
1280
1281
|
readonly container: Option.Option<"array">;
|
|
1281
|
-
readonly filePath: Option.Option<string>;
|
|
1282
1282
|
};
|
|
1283
1283
|
readonly parameters: readonly {
|
|
1284
1284
|
readonly name: string;
|
|
@@ -1332,18 +1332,7 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1332
1332
|
readonly effect: Effect.Effect<{
|
|
1333
1333
|
findConfigFile: (startDir?: string | undefined) => Effect.Effect<string, ConfigNotFoundError, never>;
|
|
1334
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
1335
|
readonly openapi: {
|
|
1346
|
-
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1347
1336
|
readonly info: {
|
|
1348
1337
|
readonly version: string;
|
|
1349
1338
|
readonly title: string;
|
|
@@ -1427,7 +1416,18 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1427
1416
|
readonly [x: string]: readonly string[];
|
|
1428
1417
|
}[] | undefined;
|
|
1429
1418
|
} | undefined;
|
|
1419
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1430
1420
|
};
|
|
1421
|
+
readonly extends?: string | undefined;
|
|
1422
|
+
readonly files?: {
|
|
1423
|
+
readonly tsconfig?: string | undefined;
|
|
1424
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1425
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1426
|
+
readonly include?: readonly string[] | undefined;
|
|
1427
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1428
|
+
} | undefined;
|
|
1429
|
+
readonly output: string;
|
|
1430
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1431
1431
|
readonly options?: {
|
|
1432
1432
|
readonly query?: {
|
|
1433
1433
|
readonly style?: "inline" | "ref" | undefined;
|
|
@@ -1442,18 +1442,7 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1442
1442
|
} | undefined;
|
|
1443
1443
|
}, ConfigError, never>;
|
|
1444
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
1445
|
readonly openapi: {
|
|
1456
|
-
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1457
1446
|
readonly info: {
|
|
1458
1447
|
readonly version: string;
|
|
1459
1448
|
readonly title: string;
|
|
@@ -1537,7 +1526,18 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1537
1526
|
readonly [x: string]: readonly string[];
|
|
1538
1527
|
}[] | undefined;
|
|
1539
1528
|
} | undefined;
|
|
1529
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1540
1530
|
};
|
|
1531
|
+
readonly extends?: string | undefined;
|
|
1532
|
+
readonly files?: {
|
|
1533
|
+
readonly tsconfig?: string | undefined;
|
|
1534
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1535
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1536
|
+
readonly include?: readonly string[] | undefined;
|
|
1537
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1538
|
+
} | undefined;
|
|
1539
|
+
readonly output: string;
|
|
1540
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1541
1541
|
readonly options?: {
|
|
1542
1542
|
readonly query?: {
|
|
1543
1543
|
readonly style?: "inline" | "ref" | undefined;
|
|
@@ -1552,18 +1552,7 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1552
1552
|
} | undefined;
|
|
1553
1553
|
}, ConfigError, never>;
|
|
1554
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
1555
|
readonly openapi: {
|
|
1566
|
-
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1567
1556
|
readonly info: {
|
|
1568
1557
|
readonly version: string;
|
|
1569
1558
|
readonly title: string;
|
|
@@ -1647,7 +1636,18 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1647
1636
|
readonly [x: string]: readonly string[];
|
|
1648
1637
|
}[] | undefined;
|
|
1649
1638
|
} | undefined;
|
|
1639
|
+
readonly version?: "3.0.3" | "3.1.0" | "3.2.0" | undefined;
|
|
1650
1640
|
};
|
|
1641
|
+
readonly extends?: string | undefined;
|
|
1642
|
+
readonly files?: {
|
|
1643
|
+
readonly tsconfig?: string | undefined;
|
|
1644
|
+
readonly entry?: string | readonly string[] | undefined;
|
|
1645
|
+
readonly dtoGlob?: string | readonly string[] | undefined;
|
|
1646
|
+
readonly include?: readonly string[] | undefined;
|
|
1647
|
+
readonly exclude?: readonly string[] | undefined;
|
|
1648
|
+
} | undefined;
|
|
1649
|
+
readonly output: string;
|
|
1650
|
+
readonly format?: "json" | "yaml" | undefined;
|
|
1651
1651
|
readonly options?: {
|
|
1652
1652
|
readonly query?: {
|
|
1653
1653
|
readonly style?: "inline" | "ref" | undefined;
|
|
@@ -1661,14 +1661,6 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1661
1661
|
readonly pathFilter?: RegExp | ((path: string) => boolean) | undefined;
|
|
1662
1662
|
} | undefined;
|
|
1663
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
1664
|
readonly info: {
|
|
1673
1665
|
readonly version: string;
|
|
1674
1666
|
readonly title: string;
|
|
@@ -1691,6 +1683,14 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1691
1683
|
readonly name: string;
|
|
1692
1684
|
readonly description?: string | undefined;
|
|
1693
1685
|
}[];
|
|
1686
|
+
readonly tsconfig: string;
|
|
1687
|
+
readonly entry: readonly string[];
|
|
1688
|
+
readonly dtoGlob: readonly string[];
|
|
1689
|
+
readonly include: readonly string[];
|
|
1690
|
+
readonly exclude: readonly string[];
|
|
1691
|
+
readonly output: string;
|
|
1692
|
+
readonly format: "json" | "yaml";
|
|
1693
|
+
readonly version?: string | undefined;
|
|
1694
1694
|
readonly basePath?: string | undefined;
|
|
1695
1695
|
readonly extractValidation: boolean;
|
|
1696
1696
|
readonly excludeDecorators: readonly string[];
|
|
@@ -1757,14 +1757,6 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1757
1757
|
}[];
|
|
1758
1758
|
}, ConfigValidationError, never>;
|
|
1759
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
1760
|
readonly info: {
|
|
1769
1761
|
readonly version: string;
|
|
1770
1762
|
readonly title: string;
|
|
@@ -1787,6 +1779,14 @@ declare const ConfigService_base: Effect.Service.Class<ConfigService, "ConfigSer
|
|
|
1787
1779
|
readonly name: string;
|
|
1788
1780
|
readonly description?: string | undefined;
|
|
1789
1781
|
}[];
|
|
1782
|
+
readonly tsconfig: string;
|
|
1783
|
+
readonly entry: readonly string[];
|
|
1784
|
+
readonly dtoGlob: readonly string[];
|
|
1785
|
+
readonly include: readonly string[];
|
|
1786
|
+
readonly exclude: readonly string[];
|
|
1787
|
+
readonly output: string;
|
|
1788
|
+
readonly format: "json" | "yaml";
|
|
1789
|
+
readonly version?: string | undefined;
|
|
1790
1790
|
readonly basePath?: string | undefined;
|
|
1791
1791
|
readonly extractValidation: boolean;
|
|
1792
1792
|
readonly excludeDecorators: readonly string[];
|
|
@@ -2271,5 +2271,5 @@ declare const generate: (options: GenerateOptions) => Effect.Effect<{
|
|
|
2271
2271
|
}, ProjectInitError | EntryNotFoundError, ModuleTraversalService | ProjectService | MethodExtractionService>;
|
|
2272
2272
|
declare const generateAsync: (options: GenerateOptions) => Promise<OpenApiPaths>;
|
|
2273
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,
|
|
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, SchemaService as h, MethodExtractionService as i, OutputService as j, generate$1 as k, defineConfig as m, generate as x, generateAsync as y, generatePathsEffect as z };
|
|
2275
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 };
|
|
@@ -2170,10 +2170,7 @@ const transformParameter = (param) => {
|
|
|
2170
2170
|
return {
|
|
2171
2171
|
name: param.name,
|
|
2172
2172
|
in: getParameterLocation(param.location),
|
|
2173
|
-
description:
|
|
2174
|
-
param.description,
|
|
2175
|
-
() => `${param.location} parameter: ${param.name}`
|
|
2176
|
-
),
|
|
2173
|
+
...Option.isSome(param.description) ? { description: param.description.value } : {},
|
|
2177
2174
|
required: param.location === "path" ? true : param.required,
|
|
2178
2175
|
schema
|
|
2179
2176
|
};
|
|
@@ -2293,7 +2290,6 @@ const transformMethodInternal = (methodInfo) => {
|
|
|
2293
2290
|
const parameters = nonBodyParams.map(transformParameter);
|
|
2294
2291
|
const requestContentTypes = getRequestContentTypes(methodInfo);
|
|
2295
2292
|
const requestBody = bodyParams.length > 0 ? {
|
|
2296
|
-
description: `Request body parameter: ${bodyParams[0].name}`,
|
|
2297
2293
|
required: bodyParams[0].required && !isInlineOptionalBodyType(bodyParams[0].tsType),
|
|
2298
2294
|
content: buildContentObject(
|
|
2299
2295
|
requestContentTypes,
|
|
@@ -5504,4 +5500,4 @@ const generate = async (configPath, overrides) => {
|
|
|
5504
5500
|
return runGeneratorApiPromise(program);
|
|
5505
5501
|
};
|
|
5506
5502
|
|
|
5507
|
-
export { generateSchemasFromFiles as $, getControllerMethodInfosEffect as A, MethodExtractionService as B, ConfigNotFoundError as C, DtoGlobResolutionError as D, EntryNotFoundError as E, transformMethod as F, transformMethodEffect as G, transformMethods as H, InvalidMethodError as I, transformMethodsEffect as J, mergeSchemas as K, mergeSchemasEffect as L, MissingGenericSchemaTempFileCleanupError as M, mergeGeneratedSchemas as N, mergeGeneratedSchemasEffect as O, ProjectInitError as P, filterSchemas as Q, filterSchemasEffect as R, SpecFileNotFoundError as S, normalizeSchemas as T, normalizeSchemasEffect as U, filterInternalSchemas as V, filterInternalSchemasEffect as W, normalizeStructureRefs as X, normalizeStructureRefsEffect as Y, toPascalCase as Z, generateSchemas as _,
|
|
5503
|
+
export { generateSchemasFromFiles as $, getControllerMethodInfosEffect as A, MethodExtractionService as B, ConfigNotFoundError as C, DtoGlobResolutionError as D, EntryNotFoundError as E, transformMethod as F, transformMethodEffect as G, transformMethods as H, InvalidMethodError as I, transformMethodsEffect as J, mergeSchemas as K, mergeSchemasEffect as L, MissingGenericSchemaTempFileCleanupError as M, mergeGeneratedSchemas as N, mergeGeneratedSchemasEffect as O, ProjectInitError as P, filterSchemas as Q, filterSchemasEffect as R, SpecFileNotFoundError as S, normalizeSchemas as T, normalizeSchemasEffect as U, filterInternalSchemas as V, filterInternalSchemasEffect as W, normalizeStructureRefs as X, normalizeStructureRefsEffect as Y, toPascalCase as Z, generateSchemas as _, SpecFileParseError as a, SchemaGenerationError as a0, SchemaService as a1, extractPropertyConstraints as a2, isPropertyOptional as a3, extractPropertyValidationInfo as a4, extractClassValidationInfo as a5, extractClassValidationInfoEffect as a6, extractClassConstraints as a7, getRequiredProperties as a8, applyConstraintsToSchema as a9, runGeneratorApiPromise as aA, mergeValidationConstraints as aa, mergeValidationConstraintsEffect as ab, ValidationService as ac, OutputService as ad, ConfigService as ae, findConfigFile as af, loadConfigFromFile as ag, loadConfig as ah, resolveConfig as ai, loadAndResolveConfig as aj, generatorServicesLayer as ak, resolveClassFromSymbol as al, getArrayInitializer as am, getStringLiteralValue as an, getSymbolFromIdentifier as ao, isModuleClass as ap, getModuleDecoratorArg as aq, resolveClassFromExpression as ar, resolveArrayOfClasses as as, getModuleMetadata as at, validateSpec as au, categorizeBrokenRefs as av, formatValidationResult as aw, generateEffect as ax, runProjectApiPromise as ay, runtimeLayerFor as az, SpecFileReadError as b, ConfigLoadError as c, defineConfig as d, ConfigValidationError as e, MissingGenericSchemaTempFileWriteError as f, generate as g, PublicApiError as h, ProjectService as i, ProjectServiceLive as j, getModules as k, getAllControllers as l, makeProjectContext as m, ModuleTraversalService as n, getControllerPrefix as o, getControllerName as p, isHttpMethod as q, getHttpMethods as r, getDecoratorName$1 as s, getControllerTags as t, getHttpDecorator as u, isHttpDecorator as v, normalizePath as w, getMethodInfo as x, getMethodInfoEffect as y, getControllerMethodInfos as z };
|
package/package.json
CHANGED