swagger-typescript-api 13.2.17 → 13.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/index.d.mts CHANGED
@@ -2,19 +2,23 @@ import * as es_toolkit0 from "es-toolkit";
2
2
  import * as es_toolkit_compat0 from "es-toolkit/compat";
3
3
  import { camelCase } from "es-toolkit/compat";
4
4
  import * as typescript from "typescript";
5
+ import { resolve } from "@apidevtools/swagger-parser";
5
6
  import * as eta from "eta";
6
7
  import { OpenAPI } from "openapi-types";
8
+ import { AnyObject, Maybe, Primitive } from "yummies/types";
7
9
  import * as swagger_schema_official0 from "swagger-schema-official";
10
+ import { PartialDeep } from "type-fest";
8
11
 
9
12
  //#region src/schema-components-map.d.ts
10
13
  declare class SchemaComponentsMap {
11
- _data: SchemaComponent[];
12
14
  config: CodeGenConfig;
15
+ _data: SchemaComponent[];
13
16
  constructor(config: CodeGenConfig);
14
17
  clear(): void;
15
18
  createRef: (paths: string[]) => string;
16
19
  parseRef: (ref: string) => string[];
17
- createComponent($ref: string, rawTypeData: SchemaComponent["rawTypeData"]): SchemaComponent;
20
+ private createComponentDraft;
21
+ createComponent($ref: string, rawTypeData: SchemaComponent["rawTypeData"] | SchemaComponent, addAtStart?: boolean): SchemaComponent;
18
22
  getComponents(): SchemaComponent[];
19
23
  filter(...componentNames: (string[] | string)[]): SchemaComponent[];
20
24
  get: ($ref: string) => SchemaComponent | null;
@@ -22,85 +26,6 @@ declare class SchemaComponentsMap {
22
26
  discriminatorsFirst(): void;
23
27
  }
24
28
  //#endregion
25
- //#region src/util/file-system.d.ts
26
- declare class FileSystem {
27
- getFileContent: (path: string) => string;
28
- readDir: (path: string) => string[];
29
- pathIsDir: (path: string) => boolean;
30
- cropExtension: (fileName: string) => string;
31
- removeDir: (path: string) => void;
32
- createDir: (path: string) => void;
33
- cleanDir: (path: string) => void;
34
- pathIsExist: (path: string) => boolean;
35
- createFile: ({
36
- path: path_,
37
- fileName,
38
- content,
39
- withPrefix
40
- }: {
41
- path: any;
42
- fileName: any;
43
- content: any;
44
- withPrefix: any;
45
- }) => void;
46
- }
47
- //#endregion
48
- //#region src/util/request.d.ts
49
- declare class Request {
50
- config: CodeGenConfig;
51
- constructor(config: CodeGenConfig);
52
- download({
53
- url,
54
- authToken,
55
- ...options
56
- }: {
57
- url: string;
58
- authToken?: string;
59
- options?: Partial<RequestInit>;
60
- }): Promise<string>;
61
- }
62
- //#endregion
63
- //#region src/swagger-schema-resolver.d.ts
64
- declare class SwaggerSchemaResolver {
65
- config: CodeGenConfig;
66
- fileSystem: FileSystem;
67
- request: Request;
68
- constructor(config: CodeGenConfig, fileSystem: FileSystem);
69
- create(): Promise<{
70
- usageSchema: OpenAPI.Document;
71
- originalSchema: OpenAPI.Document;
72
- }>;
73
- convertSwaggerObject(swaggerSchema: OpenAPI.Document, converterOptions: {
74
- patch?: boolean;
75
- }): Promise<{
76
- usageSchema: OpenAPI.Document;
77
- originalSchema: OpenAPI.Document;
78
- }>;
79
- getSwaggerSchemaByPath: (pathToSwagger: string) => string;
80
- fetchSwaggerSchemaFile(pathToSwagger: string, urlToSwagger: string, authToken?: string): Promise<string>;
81
- processSwaggerSchemaFile(file: string): any;
82
- fixSwaggerSchema({
83
- usageSchema,
84
- originalSchema
85
- }: {
86
- usageSchema: any;
87
- originalSchema: any;
88
- }): void;
89
- }
90
- //#endregion
91
- //#region src/schema-walker.d.ts
92
- declare class SchemaWalker {
93
- config: CodeGenConfig;
94
- swaggerSchemaResolver: SwaggerSchemaResolver;
95
- schemas: Map<string, OpenAPI.Document<{}>>;
96
- caches: Map<string, OpenAPI.Document<{}>>;
97
- constructor(config: CodeGenConfig, swaggerSchemaResolver: SwaggerSchemaResolver);
98
- addSchema: (name: string, schema: OpenAPI.Document) => void;
99
- _isLocalRef: (ref: string) => boolean;
100
- _isRemoteRef: (ref: string) => boolean;
101
- _getRefDataFromSchema: (schema: Record<string, unknown>, ref: string) => any;
102
- }
103
- //#endregion
104
29
  //#region src/type-name-formatter.d.ts
105
30
  type FormattingSchemaType = "enum-key" | "type-name";
106
31
  declare class TypeNameFormatter {
@@ -121,18 +46,7 @@ declare class SchemaUtils {
121
46
  config: CodeGenConfig;
122
47
  schemaComponentsMap: SchemaComponentsMap;
123
48
  typeNameFormatter: TypeNameFormatter;
124
- schemaWalker: SchemaWalker;
125
- constructor({
126
- config,
127
- schemaComponentsMap,
128
- typeNameFormatter,
129
- schemaWalker
130
- }: {
131
- config: any;
132
- schemaComponentsMap: any;
133
- typeNameFormatter: any;
134
- schemaWalker: any;
135
- });
49
+ constructor(config: CodeGenConfig, schemaComponentsMap: SchemaComponentsMap, typeNameFormatter: TypeNameFormatter);
136
50
  getRequiredProperties: (schema: any) => unknown[];
137
51
  isRefSchema: (schema: any) => boolean;
138
52
  getEnumNames: (schema: any) => any;
@@ -165,26 +79,6 @@ declare class SchemaUtils {
165
79
  formatJsValue: (value: any) => string;
166
80
  }
167
81
  //#endregion
168
- //#region src/schema-parser/schema-formatters.d.ts
169
- declare class SchemaFormatters {
170
- config: CodeGenConfig;
171
- templatesWorker: TemplatesWorker;
172
- schemaUtils: SchemaUtils;
173
- constructor(schemaParser: SchemaParser | SchemaParserFabric);
174
- base: {
175
- enum: (parsedSchema: any) => any;
176
- object: (parsedSchema: any) => any;
177
- primitive: (parsedSchema: any) => any;
178
- };
179
- inline: {
180
- enum: (parsedSchema: any) => any;
181
- object: (parsedSchema: any) => any;
182
- };
183
- formatSchema: (parsedSchema: Record<string, any>, formatType?: "base" | "inline") => any;
184
- formatDescription: (description: string | undefined, inline?: boolean) => string;
185
- formatObjectContent: (content: any) => string;
186
- }
187
- //#endregion
188
82
  //#region src/schema-parser/schema-parser-fabric.d.ts
189
83
  declare class SchemaParserFabric {
190
84
  config: CodeGenConfig;
@@ -193,17 +87,12 @@ declare class SchemaParserFabric {
193
87
  schemaFormatters: SchemaFormatters;
194
88
  templatesWorker: TemplatesWorker;
195
89
  schemaUtils: SchemaUtils;
196
- schemaWalker: SchemaWalker;
197
- constructor(config: CodeGenConfig, templatesWorker: TemplatesWorker, schemaComponentsMap: SchemaComponentsMap, typeNameFormatter: TypeNameFormatter, schemaWalker: SchemaWalker);
90
+ constructor(config: CodeGenConfig, templatesWorker: TemplatesWorker, schemaComponentsMap: SchemaComponentsMap, typeNameFormatter: TypeNameFormatter);
198
91
  createSchemaParser: ({
199
92
  schema,
200
93
  typeName,
201
94
  schemaPath
202
- }: {
203
- schema: any;
204
- typeName: any;
205
- schemaPath: any;
206
- }) => SchemaParser;
95
+ }: SchemaParserConfig) => SchemaParser;
207
96
  createSchema: ({
208
97
  content,
209
98
  linkedSchema,
@@ -211,41 +100,121 @@ declare class SchemaParserFabric {
211
100
  schemaPath,
212
101
  ...otherSchemaProps
213
102
  }: {
214
- [x: string]: any;
215
- content: any;
216
- linkedSchema?: {} | undefined;
217
- linkedComponent: any;
218
- schemaPath: any;
103
+ content: unknown;
104
+ linkedSchema?: Record<string, unknown>;
105
+ linkedComponent?: SchemaComponent;
106
+ schemaPath?: string[];
107
+ [key: string]: unknown;
219
108
  }) => any;
220
109
  createParsedComponent: ({
221
110
  typeName,
222
111
  schema,
223
112
  schemaPath
224
- }: {
225
- typeName: any;
226
- schema: any;
227
- schemaPath: any;
113
+ }: Required<SchemaParserConfig> & {
114
+ typeName: string;
228
115
  }) => SchemaComponent;
229
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
230
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
231
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
116
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
117
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
118
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
119
+ }
120
+ //#endregion
121
+ //#region src/schema-parser/schema-formatters.d.ts
122
+ declare class SchemaFormatters {
123
+ config: CodeGenConfig;
124
+ templatesWorker: TemplatesWorker;
125
+ schemaUtils: SchemaUtils;
126
+ constructor(schemaParser: SchemaParser | SchemaParserFabric);
127
+ base: {
128
+ enum: (parsedSchema: any) => any;
129
+ object: (parsedSchema: any) => any;
130
+ primitive: (parsedSchema: any) => any;
131
+ };
132
+ inline: {
133
+ enum: (parsedSchema: any) => any;
134
+ object: (parsedSchema: any) => any;
135
+ };
136
+ formatSchema: (parsedSchema: Record<string, any>, formatType?: "base" | "inline") => any;
137
+ escapeJSDocContent: (content: unknown) => string;
138
+ formatDescription: (description: string | undefined, inline?: boolean) => string;
139
+ formatObjectContent: (content: any) => string;
140
+ }
141
+ //#endregion
142
+ //#region src/schema-parser/mono-schema-parser.d.ts
143
+ interface SchemaParserConfig {
144
+ typeName?: string | null;
145
+ schema?: any;
146
+ schemaPath?: string[];
147
+ }
148
+ declare class MonoSchemaParser {
149
+ schema: any;
150
+ typeName: string | null;
151
+ schemaPath: string[];
152
+ schemaParser: SchemaParser;
153
+ schemaParserFabric: SchemaParserFabric;
154
+ typeNameFormatter: TypeNameFormatter;
155
+ schemaComponentsMap: SchemaComponentsMap;
156
+ schemaUtils: SchemaUtils;
157
+ config: CodeGenConfig;
158
+ schemaFormatters: SchemaFormatters;
159
+ constructor(schemaParser: SchemaParser, schema: unknown, typeName?: string | null, schemaPath?: string[]);
160
+ parse(): void;
161
+ buildTypeNameFromPath: () => Capitalize<string> | null;
162
+ }
163
+ //#endregion
164
+ //#region src/resolved-swagger-schema.d.ts
165
+ interface RefDetails {
166
+ ref: string;
167
+ isLocal: boolean;
168
+ externalUrlOrPath: Maybe<string>;
169
+ externalOpenapiFileName?: string;
170
+ }
171
+ declare class ResolvedSwaggerSchema {
172
+ private config;
173
+ usageSchema: OpenAPI.Document;
174
+ originalSchema: OpenAPI.Document;
175
+ private resolvers;
176
+ private parsedRefsCache;
177
+ private externalSchemaCache;
178
+ private httpMethodSegments;
179
+ private normalizeRef;
180
+ private createEscapedPathsRefVariant;
181
+ private isHttpUrl;
182
+ private getRemoteRequestHeaders;
183
+ private stripHash;
184
+ private extractRefsFromSchema;
185
+ private fetchRemoteSchemaDocument;
186
+ private warmUpRemoteSchemasCache;
187
+ private collectRemoteAbsoluteRefCandidates;
188
+ private resolveFromRemoteSchemaCache;
189
+ private constructor();
190
+ getRefDetails(ref: string): RefDetails;
191
+ isLocalRef(ref: string): boolean;
192
+ getRef(ref: Maybe<string>): Maybe<AnyObject | Primitive>;
193
+ private tryToResolveRef;
194
+ private readExternalSchema;
195
+ private resolveJsonPointer;
196
+ private absolutizeLocalRefs;
197
+ private normalizeResolvedExternalSchemaRef;
198
+ private collectExternalRefCandidates;
199
+ private tryToResolveRefFromFile;
200
+ static create(config: CodeGenConfig, usageSchema: OpenAPI.Document, originalSchema: OpenAPI.Document): Promise<ResolvedSwaggerSchema>;
232
201
  }
233
202
  //#endregion
234
203
  //#region src/schema-routes/schema-routes.d.ts
235
204
  declare class SchemaRoutes {
236
205
  config: CodeGenConfig;
237
206
  schemaParserFabric: SchemaParserFabric;
238
- schemaUtils: SchemaUtils;
239
- typeNameFormatter: TypeNameFormatter;
240
207
  schemaComponentsMap: SchemaComponentsMap;
241
208
  templatesWorker: TemplatesWorker;
209
+ typeNameFormatter: TypeNameFormatter;
210
+ schemaUtils: SchemaUtils;
242
211
  FORM_DATA_TYPES: string[];
243
212
  routes: ParsedRoute[];
244
213
  hasSecurityRoutes: boolean;
245
214
  hasQueryRoutes: boolean;
246
215
  hasFormDataRoutes: boolean;
247
216
  constructor(config: CodeGenConfig, schemaParserFabric: SchemaParserFabric, schemaComponentsMap: SchemaComponentsMap, templatesWorker: TemplatesWorker, typeNameFormatter: TypeNameFormatter);
248
- createRequestsMap: (routesByMethod: any) => {};
217
+ createRequestsMap: (resolvedSwaggerSchema: ResolvedSwaggerSchema, routesByMethod: any) => {};
249
218
  parseRouteName: (rawRoute: any) => {
250
219
  originalRoute: any;
251
220
  route: any;
@@ -281,16 +250,20 @@ declare class SchemaRoutes {
281
250
  requestInfos,
282
251
  parsedSchemas,
283
252
  operationId,
284
- defaultType
253
+ defaultType,
254
+ resolvedSwaggerSchema
285
255
  }: {
286
256
  requestInfos: any;
287
257
  parsedSchemas: any;
288
258
  operationId: any;
289
259
  defaultType: any;
260
+ resolvedSwaggerSchema: any;
290
261
  }) => any[];
291
- getResponseBodyInfo: (routeInfo: any, parsedSchemas: any) => {
262
+ getRouteLinksFromResponse: (resolvedSwaggerSchema: ResolvedSwaggerSchema, responseInfo: AnyObject, status: string) => RouteLinkInfo[];
263
+ getResponseBodyInfo: (routeInfo: any, parsedSchemas: any, resolvedSwaggerSchema: any) => {
292
264
  contentTypes: any[];
293
265
  responses: any[];
266
+ links: any[];
294
267
  success: {
295
268
  schema: any;
296
269
  type: any;
@@ -321,14 +294,8 @@ declare class SchemaRoutes {
321
294
  extractResponseBodyIfItNeeded: (routeInfo: any, responseBodyInfo: any, routeName: any) => void;
322
295
  extractResponseErrorIfItNeeded: (routeInfo: any, responseBodyInfo: any, routeName: any) => void;
323
296
  getRouteName: (rawRouteInfo: any) => RouteNameInfo;
324
- parseRouteInfo: (rawRouteName: any, routeInfo: any, method: any, usageSchema: any, parsedSchemas: any) => ParsedRoute;
325
- attachSchema: ({
326
- usageSchema,
327
- parsedSchemas
328
- }: {
329
- usageSchema: any;
330
- parsedSchemas: any;
331
- }) => void;
297
+ parseRouteInfo: (rawRouteName: any, routeInfo: any, method: any, resolvedSwaggerSchema: ResolvedSwaggerSchema, parsedSchemas: any) => ParsedRoute;
298
+ attachSchema: (resolvedSwaggerSchema: ResolvedSwaggerSchema, parsedSchemas: ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>[]) => void;
332
299
  getGroupedRoutes: () => {
333
300
  outOfModule: ParsedRoute[];
334
301
  combined?: {
@@ -339,6 +306,66 @@ declare class SchemaRoutes {
339
306
  sortRoutes: (routes: ParsedRoute[]) => ParsedRoute[];
340
307
  }
341
308
  //#endregion
309
+ //#region src/util/file-system.d.ts
310
+ declare class FileSystem {
311
+ getFileContent: (path: string) => string;
312
+ readDir: (path: string) => string[];
313
+ pathIsDir: (path: string) => boolean;
314
+ cropExtension: (fileName: string) => string;
315
+ removeDir: (path: string) => void;
316
+ createDir: (path: string) => void;
317
+ cleanDir: (path: string) => void;
318
+ pathIsExist: (path: string) => boolean;
319
+ createFile: ({
320
+ path: path_,
321
+ fileName,
322
+ content,
323
+ withPrefix
324
+ }: {
325
+ path: any;
326
+ fileName: any;
327
+ content: any;
328
+ withPrefix: any;
329
+ }) => void;
330
+ }
331
+ //#endregion
332
+ //#region src/util/request.d.ts
333
+ declare class Request {
334
+ config: CodeGenConfig;
335
+ constructor(config: CodeGenConfig);
336
+ download({
337
+ url,
338
+ authToken,
339
+ ...options
340
+ }: {
341
+ url: string;
342
+ authToken?: string;
343
+ options?: Partial<RequestInit>;
344
+ }): Promise<string>;
345
+ }
346
+ //#endregion
347
+ //#region src/swagger-schema-resolver.d.ts
348
+ interface SwaggerSchemas {
349
+ usageSchema: OpenAPI.Document;
350
+ originalSchema: OpenAPI.Document;
351
+ }
352
+ declare class SwaggerSchemaResolver {
353
+ config: CodeGenConfig;
354
+ fileSystem: FileSystem;
355
+ request: Request;
356
+ constructor(config: CodeGenConfig, fileSystem: FileSystem);
357
+ create(): Promise<ResolvedSwaggerSchema>;
358
+ convertSwaggerObject(swaggerSchema: OpenAPI.Document, converterOptions: {
359
+ patch?: boolean;
360
+ }): Promise<SwaggerSchemas>;
361
+ getSwaggerSchemaByPath: (pathToSwagger: string) => string;
362
+ fetchSwaggerSchemaFile(pathToSwagger: string, urlToSwagger: string, authToken?: string): Promise<string>;
363
+ processSwaggerSchemaFile(file: string): any;
364
+ private normalizeRefValue;
365
+ private normalizeRefsInSchema;
366
+ private fixSwaggerSchemas;
367
+ }
368
+ //#endregion
342
369
  //#region src/translators/javascript.d.ts
343
370
  declare class JavascriptTranslator extends Translator {
344
371
  compileTSCode: (input: TranslatorIO) => Record<string, string>;
@@ -376,8 +403,8 @@ declare class CodeGenProcess {
376
403
  fileSystem: FileSystem;
377
404
  codeFormatter: CodeFormatter;
378
405
  templatesWorker: TemplatesWorker;
379
- schemaWalker: SchemaWalker;
380
406
  javascriptTranslator: JavascriptTranslator;
407
+ swaggerRefs: Awaited<ReturnType<typeof resolve>> | undefined | null;
381
408
  constructor(config: Partial<GenerateApiConfiguration["config"]>);
382
409
  start(): Promise<{
383
410
  files: TranslatorIO[];
@@ -461,13 +488,14 @@ declare class CodeGenProcess {
461
488
  Tuple: (values: unknown[]) => string;
462
489
  };
463
490
  formatDescription: (description: string | undefined, inline?: boolean) => string;
491
+ escapeJSDocContent: (content: unknown) => string;
464
492
  internalCase: typeof camelCase;
465
493
  classNameCase: typeof pascalCase;
466
494
  pascalCase: typeof pascalCase;
467
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
468
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
495
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
496
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
469
497
  getComponentByRef: ($ref: string) => SchemaComponent | null;
470
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
498
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
471
499
  checkAndAddNull: (schema: any, type: any) => any;
472
500
  safeAddNullToType: (schema: any, type: any) => any;
473
501
  isNeedToAddNull: (schema: any, type: any) => any;
@@ -566,13 +594,14 @@ declare class CodeGenProcess {
566
594
  Tuple: (values: unknown[]) => string;
567
595
  };
568
596
  formatDescription: (description: string | undefined, inline?: boolean) => string;
597
+ escapeJSDocContent: (content: unknown) => string;
569
598
  internalCase: typeof camelCase;
570
599
  classNameCase: typeof pascalCase;
571
600
  pascalCase: typeof pascalCase;
572
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
573
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
601
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
602
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
574
603
  getComponentByRef: ($ref: string) => SchemaComponent | null;
575
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
604
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
576
605
  checkAndAddNull: (schema: any, type: any) => any;
577
606
  safeAddNullToType: (schema: any, type: any) => any;
578
607
  isNeedToAddNull: (schema: any, type: any) => any;
@@ -651,15 +680,18 @@ declare class SchemaParser {
651
680
  schemaFormatters: SchemaFormatters;
652
681
  schemaUtils: SchemaUtils;
653
682
  templatesWorker: TemplatesWorker;
654
- schemaWalker: SchemaWalker;
655
- typeName: any;
683
+ typeName: string | null;
656
684
  schema: any;
657
- schemaPath: never[];
658
- constructor(schemaParserFabric: any, {
685
+ schemaPath: string[];
686
+ constructor(schemaParserFabric: SchemaParserFabric, {
659
687
  typeName,
660
688
  schema,
661
689
  schemaPath
662
- }?: {});
690
+ }?: {
691
+ typeName?: string | null;
692
+ schema?: any;
693
+ schemaPath?: string[];
694
+ });
663
695
  _complexSchemaParsers: {
664
696
  oneOf: (schema: any) => any;
665
697
  allOf: (schema: any) => any;
@@ -717,23 +749,6 @@ declare const SCHEMA_TYPES$1: {
717
749
  readonly COMPLEX_UNKNOWN: "__unknown";
718
750
  };
719
751
  //#endregion
720
- //#region src/schema-parser/mono-schema-parser.d.ts
721
- declare class MonoSchemaParser {
722
- schema: any;
723
- typeName: any;
724
- schemaPath: never[];
725
- schemaParser: SchemaParser;
726
- schemaParserFabric: SchemaParserFabric;
727
- typeNameFormatter: TypeNameFormatter;
728
- schemaComponentsMap: SchemaComponentsMap;
729
- schemaUtils: SchemaUtils;
730
- config: CodeGenConfig;
731
- schemaFormatters: SchemaFormatters;
732
- constructor(schemaParser: SchemaParser, schema: any, typeName?: null, schemaPath?: never[]);
733
- parse(): void;
734
- buildTypeNameFromPath: () => Capitalize<string> | null;
735
- }
736
- //#endregion
737
752
  //#region types/index.d.ts
738
753
  type HttpClientType = (typeof HTTP_CLIENT)[keyof typeof HTTP_CLIENT];
739
754
  type CodeGenConstruct = {
@@ -847,6 +862,8 @@ interface Hooks {
847
862
  onFormatTypeName?: (typeName: string, rawTypeName?: string, schemaType?: "type-name" | "enum-key") => string | undefined;
848
863
  /** customize name of route (operationId), you can do it with using onCreateRouteName too */
849
864
  onFormatRouteName?: (routeInfo: RawRouteInfo, templateRouteName: string) => string | undefined;
865
+ onFormatExternalTypeName?: (typeName: string, refInfo: RefDetails) => string | undefined;
866
+ onFixDuplicateExternalTypeName?: (typeName: string, refInfo: RefDetails, existedTypeNames: string[]) => string | undefined;
850
867
  }
851
868
  type RouteNameRouteInfo = Record<string, unknown>;
852
869
  type RouteNameInfo = {
@@ -932,6 +949,14 @@ interface RequestResponseInfo {
932
949
  description: string;
933
950
  status: string | number;
934
951
  isSuccess: boolean;
952
+ links?: RouteLinkInfo[];
953
+ }
954
+ interface RouteLinkInfo {
955
+ status: string | number;
956
+ name: string;
957
+ operationId?: string;
958
+ operationRef?: string;
959
+ parameters?: Record<string, string>;
935
960
  }
936
961
  type RawRouteInfo = {
937
962
  operationId: string;
@@ -939,6 +964,7 @@ type RawRouteInfo = {
939
964
  route: string;
940
965
  moduleName: string;
941
966
  responsesTypes: RequestResponseInfo[];
967
+ links?: RouteLinkInfo[];
942
968
  description?: string;
943
969
  tags?: string[];
944
970
  summary?: string;
@@ -990,6 +1016,7 @@ interface ParsedRoute {
990
1016
  responseBodyInfo?: {
991
1017
  contentTypes: any[];
992
1018
  responses: any[];
1019
+ links?: RouteLinkInfo[];
993
1020
  success?: Record<string, any>;
994
1021
  error?: Record<string, any>;
995
1022
  full?: Record<string, any>;
@@ -1123,8 +1150,8 @@ interface GenerateApiConfiguration {
1123
1150
  extractRequestBody: boolean; /** generated http client type */
1124
1151
  httpClientType: "axios" | "fetch"; /** generate readonly properties */
1125
1152
  addReadonly: boolean; /** customise primitive type mappings */
1126
- primitiveTypeConstructs?: (struct: PrimitiveTypeStruct) => Partial<PrimitiveTypeStruct>; /** customise code generation constructs */
1127
- codeGenConstructs?: (struct: CodeGenConstruct) => Partial<CodeGenConstruct>; /** extract response body type to data contract */
1153
+ primitiveTypeConstructs?: ((struct: PrimitiveTypeStruct) => PartialDeep<PrimitiveTypeStruct>) | PartialDeep<PrimitiveTypeStruct>; /** customise code generation constructs */
1154
+ codeGenConstructs?: ((struct: CodeGenConstruct) => PartialDeep<CodeGenConstruct>) | PartialDeep<CodeGenConstruct>; /** extract response body type to data contract */
1128
1155
  extractResponseBody: boolean; /** extract response error type to data contract */
1129
1156
  extractResponseError: boolean; /** extract all enums from nested types/interfaces to `enum` construction */
1130
1157
  extractEnums: boolean; /** extract all enums from inline interface/type content to typescript enum construction */
@@ -1330,6 +1357,7 @@ declare class CodeGenConfig {
1330
1357
  };
1331
1358
  routeNameDuplicatesMap: Map<any, any>;
1332
1359
  hooks: Hooks;
1360
+ resolvedSwaggerSchema: ResolvedSwaggerSchema;
1333
1361
  defaultResponseType: string;
1334
1362
  singleHttpClient: boolean;
1335
1363
  httpClientType: "fetch";
@@ -1382,7 +1410,7 @@ declare class CodeGenConfig {
1382
1410
  spec: OpenAPI.Document | null;
1383
1411
  fileName: string;
1384
1412
  authorizationToken: string | undefined;
1385
- requestOptions: null;
1413
+ requestOptions: Record<string, any> | null;
1386
1414
  jsPrimitiveTypes: string[];
1387
1415
  jsEmptyTypes: string[];
1388
1416
  fixInvalidTypeNamePrefix: string;
@@ -1538,7 +1566,9 @@ declare class CodeGenConfig {
1538
1566
  hooks,
1539
1567
  ...otherConfig
1540
1568
  }: Partial<GenerateApiConfiguration["config"]>);
1541
- update: (update: Partial<GenerateApiConfiguration["config"]>) => void;
1569
+ update: (update: Partial<GenerateApiConfiguration["config"] & {
1570
+ resolvedSwaggerSchema: ResolvedSwaggerSchema;
1571
+ }>) => void;
1542
1572
  }
1543
1573
  //#endregion
1544
1574
  //#region src/code-formatter.d.ts
@@ -1655,13 +1685,14 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1655
1685
  Tuple: (values: unknown[]) => string;
1656
1686
  };
1657
1687
  formatDescription: (description: string | undefined, inline?: boolean) => string;
1688
+ escapeJSDocContent: (content: unknown) => string;
1658
1689
  internalCase: typeof es_toolkit_compat0.camelCase;
1659
1690
  classNameCase: typeof pascalCase;
1660
1691
  pascalCase: typeof pascalCase;
1661
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
1662
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
1692
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
1693
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
1663
1694
  getComponentByRef: ($ref: string) => SchemaComponent | null;
1664
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
1695
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
1665
1696
  checkAndAddNull: (schema: any, type: any) => any;
1666
1697
  safeAddNullToType: (schema: any, type: any) => any;
1667
1698
  isNeedToAddNull: (schema: any, type: any) => any;
@@ -1709,5 +1740,5 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1709
1740
  }) => Promise<string>;
1710
1741
  }>;
1711
1742
  //#endregion
1712
- export { ExtractingOptions, GenerateApiConfiguration, GenerateApiOutput, GenerateApiParams, GenerateTemplatesOutput, GenerateTemplatesParams, Hooks, HttpClientType, ModelType, ParsedRoute, ParsedRouteRequest, ParsedRouteResponse, ParsedSchema, PathArgInfo, RawRouteInfo, RequestContentKind, RequestResponseInfo, RouteNameInfo, RouteNameRouteInfo, SCHEMA_TYPES, SchemaComponent, SchemaTypeEnumContent, SchemaTypeObjectContent, SchemaTypePrimitiveContent, constants_d_exports as constants, generateApi, generateTemplates };
1743
+ export { ExtractingOptions, GenerateApiConfiguration, GenerateApiOutput, GenerateApiParams, GenerateTemplatesOutput, GenerateTemplatesParams, Hooks, HttpClientType, ModelType, ParsedRoute, ParsedRouteRequest, ParsedRouteResponse, ParsedSchema, PathArgInfo, RawRouteInfo, RequestContentKind, RequestResponseInfo, RouteLinkInfo, RouteNameInfo, RouteNameRouteInfo, SCHEMA_TYPES, SchemaComponent, SchemaTypeEnumContent, SchemaTypeObjectContent, SchemaTypePrimitiveContent, constants_d_exports as constants, generateApi, generateTemplates };
1713
1744
  //# sourceMappingURL=index.d.mts.map