swagger-typescript-api 13.2.16 → 13.2.18

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.cts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { OpenAPI } from "openapi-types";
2
2
  import * as typescript from "typescript";
3
- import * as lodash0 from "lodash";
4
- import lodash from "lodash";
3
+ import * as es_toolkit_compat0 from "es-toolkit/compat";
4
+ import { camelCase } from "es-toolkit/compat";
5
5
  import * as swagger_schema_official0 from "swagger-schema-official";
6
- import * as eta0 from "eta";
6
+ import * as es_toolkit0 from "es-toolkit";
7
+ import * as eta from "eta";
8
+ import { PartialDeep } from "type-fest";
7
9
 
8
- //#region rolldown:runtime
10
+ //#region \0rolldown/runtime.js
9
11
  //#endregion
10
12
  //#region src/schema-components-map.d.ts
11
13
  declare class SchemaComponentsMap {
@@ -166,26 +168,6 @@ declare class SchemaUtils {
166
168
  formatJsValue: (value: any) => string;
167
169
  }
168
170
  //#endregion
169
- //#region src/schema-parser/schema-formatters.d.ts
170
- declare class SchemaFormatters {
171
- config: CodeGenConfig;
172
- templatesWorker: TemplatesWorker;
173
- schemaUtils: SchemaUtils;
174
- constructor(schemaParser: SchemaParser | SchemaParserFabric);
175
- base: {
176
- enum: (parsedSchema: any) => any;
177
- object: (parsedSchema: any) => any;
178
- primitive: (parsedSchema: any) => any;
179
- };
180
- inline: {
181
- enum: (parsedSchema: any) => any;
182
- object: (parsedSchema: any) => any;
183
- };
184
- formatSchema: (parsedSchema: Record<string, any>, formatType?: "base" | "inline") => any;
185
- formatDescription: (description: any, inline: any) => any;
186
- formatObjectContent: (content: any) => string;
187
- }
188
- //#endregion
189
171
  //#region src/schema-parser/schema-parser-fabric.d.ts
190
172
  declare class SchemaParserFabric {
191
173
  config: CodeGenConfig;
@@ -200,11 +182,7 @@ declare class SchemaParserFabric {
200
182
  schema,
201
183
  typeName,
202
184
  schemaPath
203
- }: {
204
- schema: any;
205
- typeName: any;
206
- schemaPath: any;
207
- }) => SchemaParser;
185
+ }: SchemaParserConfig) => SchemaParser;
208
186
  createSchema: ({
209
187
  content,
210
188
  linkedSchema,
@@ -212,24 +190,65 @@ declare class SchemaParserFabric {
212
190
  schemaPath,
213
191
  ...otherSchemaProps
214
192
  }: {
215
- [x: string]: any;
216
- content: any;
217
- linkedSchema?: {} | undefined;
218
- linkedComponent: any;
219
- schemaPath: any;
193
+ content: unknown;
194
+ linkedSchema?: Record<string, unknown>;
195
+ linkedComponent?: SchemaComponent;
196
+ schemaPath?: string[];
197
+ [key: string]: unknown;
220
198
  }) => any;
221
199
  createParsedComponent: ({
222
200
  typeName,
223
201
  schema,
224
202
  schemaPath
225
- }: {
226
- typeName: any;
227
- schema: any;
228
- schemaPath: any;
203
+ }: Required<SchemaParserConfig> & {
204
+ typeName: string;
229
205
  }) => SchemaComponent;
230
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
231
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
232
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
206
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
207
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
208
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
209
+ }
210
+ //#endregion
211
+ //#region src/schema-parser/schema-formatters.d.ts
212
+ declare class SchemaFormatters {
213
+ config: CodeGenConfig;
214
+ templatesWorker: TemplatesWorker;
215
+ schemaUtils: SchemaUtils;
216
+ constructor(schemaParser: SchemaParser | SchemaParserFabric);
217
+ base: {
218
+ enum: (parsedSchema: any) => any;
219
+ object: (parsedSchema: any) => any;
220
+ primitive: (parsedSchema: any) => any;
221
+ };
222
+ inline: {
223
+ enum: (parsedSchema: any) => any;
224
+ object: (parsedSchema: any) => any;
225
+ };
226
+ formatSchema: (parsedSchema: Record<string, any>, formatType?: "base" | "inline") => any;
227
+ escapeJSDocContent: (content: unknown) => string;
228
+ formatDescription: (description: string | undefined, inline?: boolean) => string;
229
+ formatObjectContent: (content: any) => string;
230
+ }
231
+ //#endregion
232
+ //#region src/schema-parser/mono-schema-parser.d.ts
233
+ interface SchemaParserConfig {
234
+ typeName?: string | null;
235
+ schema?: any;
236
+ schemaPath?: string[];
237
+ }
238
+ declare class MonoSchemaParser {
239
+ schema: any;
240
+ typeName: string | null;
241
+ schemaPath: string[];
242
+ schemaParser: SchemaParser;
243
+ schemaParserFabric: SchemaParserFabric;
244
+ typeNameFormatter: TypeNameFormatter;
245
+ schemaComponentsMap: SchemaComponentsMap;
246
+ schemaUtils: SchemaUtils;
247
+ config: CodeGenConfig;
248
+ schemaFormatters: SchemaFormatters;
249
+ constructor(schemaParser: SchemaParser, schema: unknown, typeName?: string | null, schemaPath?: string[]);
250
+ parse(): void;
251
+ buildTypeNameFromPath: () => Capitalize<string> | null;
233
252
  }
234
253
  //#endregion
235
254
  //#region src/schema-routes/schema-routes.d.ts
@@ -246,47 +265,12 @@ declare class SchemaRoutes {
246
265
  hasQueryRoutes: boolean;
247
266
  hasFormDataRoutes: boolean;
248
267
  constructor(config: CodeGenConfig, schemaParserFabric: SchemaParserFabric, schemaComponentsMap: SchemaComponentsMap, templatesWorker: TemplatesWorker, typeNameFormatter: TypeNameFormatter);
249
- createRequestsMap: (routeInfoByMethodsMap: any) => {};
250
- parseRouteName: (originalRouteName: any) => {
251
- originalRoute: string;
252
- route: string;
253
- pathParams: {
254
- $match: string;
255
- name: string;
256
- required: boolean;
257
- type: "string";
258
- description: string;
259
- schema: {
260
- type: string;
261
- };
262
- in: "path" | "query";
263
- }[];
264
- queryParams: {
265
- $match: string;
266
- name: string;
267
- required: boolean;
268
- type: "string";
269
- description: string;
270
- schema: {
271
- type: string;
272
- };
273
- in: "path" | "query";
274
- }[];
275
- } | {
268
+ createRequestsMap: (routesByMethod: any) => {};
269
+ parseRouteName: (rawRoute: any) => {
276
270
  originalRoute: any;
277
271
  route: any;
278
- pathParams: never[];
279
- queryParams: {
280
- $match: unknown;
281
- name: string;
282
- required: boolean;
283
- type: string;
284
- description: string;
285
- schema: {
286
- type: string;
287
- };
288
- in: string;
289
- }[];
272
+ pathParams: any[];
273
+ queryParams: any[];
290
274
  };
291
275
  getRouteParams: (routeInfo: any, pathParamsFromRouteName: any, queryParamsFromRouteName: any) => {
292
276
  path: never[];
@@ -323,16 +307,16 @@ declare class SchemaRoutes {
323
307
  parsedSchemas: any;
324
308
  operationId: any;
325
309
  defaultType: any;
326
- }) => never[];
310
+ }) => any[];
327
311
  getResponseBodyInfo: (routeInfo: any, parsedSchemas: any) => {
328
312
  contentTypes: any[];
329
- responses: never[];
313
+ responses: any[];
330
314
  success: {
331
- schema: undefined;
315
+ schema: any;
332
316
  type: any;
333
317
  };
334
318
  error: {
335
- schemas: never[];
319
+ schemas: any[];
336
320
  type: string;
337
321
  };
338
322
  full: {
@@ -385,9 +369,6 @@ declare class JavascriptTranslator extends Translator {
385
369
  }[]>;
386
370
  }
387
371
  //#endregion
388
- //#region src/util/internal-case.d.ts
389
- declare function internalCase(value: string): string;
390
- //#endregion
391
372
  //#region src/util/name-resolver.d.ts
392
373
  type Resolver = (reserved: string[], extras?: string[]) => string;
393
374
  declare class NameResolver {
@@ -499,14 +480,15 @@ declare class CodeGenProcess {
499
480
  TypeWithGeneric: (typeName: unknown, genericArgs: unknown[]) => string;
500
481
  Tuple: (values: unknown[]) => string;
501
482
  };
502
- formatDescription: (description: any, inline: any) => any;
503
- internalCase: typeof internalCase;
483
+ formatDescription: (description: string | undefined, inline?: boolean) => string;
484
+ escapeJSDocContent: (content: unknown) => string;
485
+ internalCase: typeof camelCase;
504
486
  classNameCase: typeof pascalCase;
505
487
  pascalCase: typeof pascalCase;
506
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
507
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
488
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
489
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
508
490
  getComponentByRef: ($ref: string) => SchemaComponent | null;
509
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
491
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
510
492
  checkAndAddNull: (schema: any, type: any) => any;
511
493
  safeAddNullToType: (schema: any, type: any) => any;
512
494
  isNeedToAddNull: (schema: any, type: any) => any;
@@ -528,7 +510,7 @@ declare class CodeGenProcess {
528
510
  eol?: boolean | undefined;
529
511
  }) => string;
530
512
  NameResolver: typeof NameResolver;
531
- _: lodash.LoDashStatic;
513
+ _: Record<string, unknown>;
532
514
  require: (packageOrPath: string) => any;
533
515
  };
534
516
  };
@@ -604,14 +586,15 @@ declare class CodeGenProcess {
604
586
  TypeWithGeneric: (typeName: unknown, genericArgs: unknown[]) => string;
605
587
  Tuple: (values: unknown[]) => string;
606
588
  };
607
- formatDescription: (description: any, inline: any) => any;
608
- internalCase: typeof internalCase;
589
+ formatDescription: (description: string | undefined, inline?: boolean) => string;
590
+ escapeJSDocContent: (content: unknown) => string;
591
+ internalCase: typeof camelCase;
609
592
  classNameCase: typeof pascalCase;
610
593
  pascalCase: typeof pascalCase;
611
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
612
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
594
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
595
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
613
596
  getComponentByRef: ($ref: string) => SchemaComponent | null;
614
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
597
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
615
598
  checkAndAddNull: (schema: any, type: any) => any;
616
599
  safeAddNullToType: (schema: any, type: any) => any;
617
600
  isNeedToAddNull: (schema: any, type: any) => any;
@@ -633,7 +616,7 @@ declare class CodeGenProcess {
633
616
  eol?: boolean | undefined;
634
617
  }) => string;
635
618
  NameResolver: typeof NameResolver;
636
- _: lodash.LoDashStatic;
619
+ _: Record<string, unknown>;
637
620
  require: (packageOrPath: string) => any;
638
621
  };
639
622
  config: CodeGenConfig;
@@ -691,14 +674,18 @@ declare class SchemaParser {
691
674
  schemaUtils: SchemaUtils;
692
675
  templatesWorker: TemplatesWorker;
693
676
  schemaWalker: SchemaWalker;
694
- typeName: any;
677
+ typeName: string | null;
695
678
  schema: any;
696
- schemaPath: never[];
697
- constructor(schemaParserFabric: any, {
679
+ schemaPath: string[];
680
+ constructor(schemaParserFabric: SchemaParserFabric, {
698
681
  typeName,
699
682
  schema,
700
683
  schemaPath
701
- }?: {});
684
+ }?: {
685
+ typeName?: string | null;
686
+ schema?: any;
687
+ schemaPath?: string[];
688
+ });
702
689
  _complexSchemaParsers: {
703
690
  oneOf: (schema: any) => any;
704
691
  allOf: (schema: any) => any;
@@ -756,23 +743,6 @@ declare const SCHEMA_TYPES$1: {
756
743
  readonly COMPLEX_UNKNOWN: "__unknown";
757
744
  };
758
745
  //#endregion
759
- //#region src/schema-parser/mono-schema-parser.d.ts
760
- declare class MonoSchemaParser {
761
- schema: any;
762
- typeName: any;
763
- schemaPath: never[];
764
- schemaParser: SchemaParser;
765
- schemaParserFabric: SchemaParserFabric;
766
- typeNameFormatter: TypeNameFormatter;
767
- schemaComponentsMap: SchemaComponentsMap;
768
- schemaUtils: SchemaUtils;
769
- config: CodeGenConfig;
770
- schemaFormatters: SchemaFormatters;
771
- constructor(schemaParser: SchemaParser, schema: any, typeName?: null, schemaPath?: never[]);
772
- parse(): void;
773
- buildTypeNameFromPath: () => Capitalize<string> | null;
774
- }
775
- //#endregion
776
746
  //#region types/index.d.ts
777
747
  type HttpClientType = (typeof HTTP_CLIENT)[keyof typeof HTTP_CLIENT];
778
748
  type CodeGenConstruct = {
@@ -843,8 +813,7 @@ interface GenerateApiParamsFromSpecLiteral extends Partial<GenerateApiConfigurat
843
813
  }
844
814
  type GenerateApiParams = GenerateApiParamsFromPath | GenerateApiParamsFromUrl | GenerateApiParamsFromSpecLiteral;
845
815
  type BuildRouteParam = {
846
- /** {bar} */
847
- $match: string;
816
+ /** {bar} */$match: string;
848
817
  name: string;
849
818
  required: boolean;
850
819
  type: "string";
@@ -855,9 +824,7 @@ type BuildRouteParam = {
855
824
  in: "path" | "query";
856
825
  };
857
826
  type BuildRoutePath = {
858
- /** /foo/{bar}/baz */
859
- originalRoute: string;
860
- /** /foo/${bar}/baz */
827
+ /** /foo/{bar}/baz */originalRoute: string; /** /foo/${bar}/baz */
861
828
  route: string;
862
829
  pathParams: BuildRouteParam[];
863
830
  queryParams: BuildRouteParam[];
@@ -919,7 +886,7 @@ type SchemaTypeEnumContent = {
919
886
  type: string;
920
887
  value: string;
921
888
  };
922
- interface ParsedSchema<C$1> {
889
+ interface ParsedSchema<C> {
923
890
  $parsedSchema: boolean;
924
891
  schemaType: string;
925
892
  type: string;
@@ -927,7 +894,7 @@ interface ParsedSchema<C$1> {
927
894
  name: string;
928
895
  description?: string;
929
896
  allFieldsAreOptional?: boolean;
930
- content: C$1;
897
+ content: C;
931
898
  isExtractedRequestParams?: boolean;
932
899
  isExtractedRequestBody?: boolean;
933
900
  isExtractedResponseBody?: boolean;
@@ -965,7 +932,7 @@ declare enum RequestContentKind {
965
932
  FORM_DATA = "FORM_DATA",
966
933
  IMAGE = "IMAGE",
967
934
  OTHER = "OTHER",
968
- TEXT = "TEXT",
935
+ TEXT = "TEXT"
969
936
  }
970
937
  interface RequestResponseInfo {
971
938
  contentTypes: string[];
@@ -1066,7 +1033,7 @@ declare enum SCHEMA_TYPES {
1066
1033
  COMPLEX_ANY_OF = "anyOf",
1067
1034
  COMPLEX_ALL_OF = "allOf",
1068
1035
  COMPLEX_NOT = "not",
1069
- COMPLEX_UNKNOWN = "__unknown",
1036
+ COMPLEX_UNKNOWN = "__unknown"
1070
1037
  }
1071
1038
  type MAIN_SCHEMA_TYPES = SCHEMA_TYPES.PRIMITIVE | SCHEMA_TYPES.OBJECT | SCHEMA_TYPES.ENUM;
1072
1039
  type ExtractingOptions = {
@@ -1087,20 +1054,14 @@ type ExtractingOptions = {
1087
1054
  };
1088
1055
  interface GenerateApiConfiguration {
1089
1056
  apiConfig: {
1090
- /** base url from schema */
1091
- baseUrl: string;
1092
- /** document title */
1093
- title: string;
1094
- /** document version */
1095
- version: string;
1096
- /** description split into lines */
1097
- description: string[];
1098
- /** flag that description is present */
1057
+ /** base url from schema */baseUrl: string; /** document title */
1058
+ title: string; /** document version */
1059
+ version: string; /** description split into lines */
1060
+ description: string[]; /** flag that description is present */
1099
1061
  hasDescription: boolean;
1100
1062
  };
1101
1063
  config: {
1102
- /** path to swagger schema */
1103
- input: string;
1064
+ /** path to swagger schema */input: string;
1104
1065
  /**
1105
1066
  * generate separated files for http client, data contracts, and routes
1106
1067
  * @default false
@@ -1111,10 +1072,8 @@ interface GenerateApiConfiguration {
1111
1072
  * may be set to `false` to skip writing content to disk; in this case
1112
1073
  * the `files` array on the return value will contain the generated contents.
1113
1074
  */
1114
- output: string | false;
1115
- /** url to swagger schema */
1116
- url: string;
1117
- /** swagger schema JSON */
1075
+ output: string | false; /** url to swagger schema */
1076
+ url: string; /** swagger schema JSON */
1118
1077
  spec: unknown;
1119
1078
  /**
1120
1079
  * file name for the generated API module
@@ -1127,95 +1086,57 @@ interface GenerateApiConfiguration {
1127
1086
  */
1128
1087
  templates: string;
1129
1088
  templatePaths: {
1130
- /** `templates/base` */
1131
- base: string;
1132
- /** `templates/default` */
1133
- default: string;
1134
- /** `templates/modular` */
1135
- modular: string;
1136
- /** usage path if `--templates` option is not set */
1137
- original: string;
1138
- /** custom path to templates (`--templates`) */
1089
+ /** `templates/base` */base: string; /** `templates/default` */
1090
+ default: string; /** `templates/modular` */
1091
+ modular: string; /** usage path if `--templates` option is not set */
1092
+ original: string; /** custom path to templates (`--templates`) */
1139
1093
  custom: string | null;
1140
- };
1141
- /** authorisation token for private swagger schema access */
1142
- authorizationToken?: string;
1143
- /** generate additional information about request responses and error typings */
1094
+ }; /** authorisation token for private swagger schema access */
1095
+ authorizationToken?: string; /** generate additional information about request responses and error typings */
1144
1096
  generateResponses: boolean;
1145
1097
  /**
1146
1098
  * use "default" response status code as success response.
1147
1099
  * some swagger schemas treat "default" as a successful response.
1148
1100
  */
1149
- defaultResponseAsSuccess: boolean;
1150
- /** generate type definitions for API routes */
1151
- generateRouteTypes: boolean;
1152
- /** generate an API client */
1153
- generateClient: boolean;
1154
- /** generate all "enum" types as union types (T1 | T2 | TN) */
1155
- generateUnionEnums: boolean;
1156
- /** parsed swagger schema */
1157
- swaggerSchema: object;
1158
- /** original swagger schema */
1159
- originalSchema: object;
1160
- /** map of schema component references */
1161
- componentsMap: Record<string, SchemaComponent>;
1162
- /** flag indicating the schema was converted from Swagger 2.0 */
1163
- convertedFromSwagger2: boolean;
1164
- /** determines which path index should be used for routes separation */
1165
- moduleNameIndex: number;
1166
- /** use the first tag for the module name */
1167
- moduleNameFirstTag: boolean;
1168
- /** extra templates */
1101
+ defaultResponseAsSuccess: boolean; /** generate type definitions for API routes */
1102
+ generateRouteTypes: boolean; /** generate an API client */
1103
+ generateClient: boolean; /** generate all "enum" types as union types (T1 | T2 | TN) */
1104
+ generateUnionEnums: boolean; /** parsed swagger schema */
1105
+ swaggerSchema: object; /** original swagger schema */
1106
+ originalSchema: object; /** map of schema component references */
1107
+ componentsMap: Record<string, SchemaComponent>; /** flag indicating the schema was converted from Swagger 2.0 */
1108
+ convertedFromSwagger2: boolean; /** determines which path index should be used for routes separation */
1109
+ moduleNameIndex: number; /** use the first tag for the module name */
1110
+ moduleNameFirstTag: boolean; /** extra templates */
1169
1111
  extraTemplates: {
1170
1112
  name: string;
1171
1113
  path: string;
1172
- }[];
1173
- /** extract request params to data contract */
1174
- extractRequestParams: boolean;
1175
- /** unwrap the data item from the response */
1176
- unwrapResponseData: boolean;
1177
- /** sort data contracts in alphabetical order */
1178
- sortTypes: boolean;
1179
- /** sort routes in alphabetical order */
1180
- sortRoutes: boolean;
1181
- /** ability to send HttpClient instance to Api constructor */
1182
- singleHttpClient: boolean;
1183
- /** prefix string value for type names */
1184
- typePrefix: string;
1185
- /** suffix string value for type names */
1186
- typeSuffix: string;
1187
- /** prefix string value for enum keys */
1188
- enumKeyPrefix: string;
1189
- /** suffix string value for enum keys */
1190
- enumKeySuffix: string;
1191
- /** fix up small errors in the swagger source definition */
1192
- patch: boolean;
1193
- /** remove output directory before generating */
1194
- cleanOutput: boolean;
1195
- /** output debug messages */
1114
+ }[]; /** extract request params to data contract */
1115
+ extractRequestParams: boolean; /** unwrap the data item from the response */
1116
+ unwrapResponseData: boolean; /** sort data contracts in alphabetical order */
1117
+ sortTypes: boolean; /** sort routes in alphabetical order */
1118
+ sortRoutes: boolean; /** ability to send HttpClient instance to Api constructor */
1119
+ singleHttpClient: boolean; /** prefix string value for type names */
1120
+ typePrefix: string; /** suffix string value for type names */
1121
+ typeSuffix: string; /** prefix string value for enum keys */
1122
+ enumKeyPrefix: string; /** suffix string value for enum keys */
1123
+ enumKeySuffix: string; /** fix up small errors in the swagger source definition */
1124
+ patch: boolean; /** remove output directory before generating */
1125
+ cleanOutput: boolean; /** output debug messages */
1196
1126
  debug: boolean;
1197
1127
  /**
1198
1128
  * generate array types as Array<Type>
1199
1129
  * @default false
1200
1130
  */
1201
- anotherArrayType: boolean;
1202
- /** extract request body type to data contract */
1203
- extractRequestBody: boolean;
1204
- /** generated http client type */
1205
- httpClientType: "axios" | "fetch";
1206
- /** generate readonly properties */
1207
- addReadonly: boolean;
1208
- /** customise primitive type mappings */
1209
- primitiveTypeConstructs?: (struct: PrimitiveTypeStruct) => Partial<PrimitiveTypeStruct>;
1210
- /** customise code generation constructs */
1211
- codeGenConstructs?: (struct: CodeGenConstruct) => Partial<CodeGenConstruct>;
1212
- /** extract response body type to data contract */
1213
- extractResponseBody: boolean;
1214
- /** extract response error type to data contract */
1215
- extractResponseError: boolean;
1216
- /** extract all enums from nested types/interfaces to `enum` construction */
1217
- extractEnums: boolean;
1218
- /** extract all enums from inline interface/type content to typescript enum construction */
1131
+ anotherArrayType: boolean; /** extract request body type to data contract */
1132
+ extractRequestBody: boolean; /** generated http client type */
1133
+ httpClientType: "axios" | "fetch"; /** generate readonly properties */
1134
+ addReadonly: boolean; /** customise primitive type mappings */
1135
+ primitiveTypeConstructs?: ((struct: PrimitiveTypeStruct) => PartialDeep<PrimitiveTypeStruct>) | PartialDeep<PrimitiveTypeStruct>; /** customise code generation constructs */
1136
+ codeGenConstructs?: ((struct: CodeGenConstruct) => PartialDeep<CodeGenConstruct>) | PartialDeep<CodeGenConstruct>; /** extract response body type to data contract */
1137
+ extractResponseBody: boolean; /** extract response error type to data contract */
1138
+ extractResponseError: boolean; /** extract all enums from nested types/interfaces to `enum` construction */
1139
+ extractEnums: boolean; /** extract all enums from inline interface/type content to typescript enum construction */
1219
1140
  extractResponses: boolean;
1220
1141
  /**
1221
1142
  * prefix string value needed to fix invalid type names
@@ -1236,52 +1157,38 @@ interface GenerateApiConfiguration {
1236
1157
  * generate js api module with declaration file
1237
1158
  * @default false
1238
1159
  */
1239
- toJS: boolean;
1240
- /** disable throwing on a non-successful response */
1160
+ toJS: boolean; /** disable throwing on a non-successful response */
1241
1161
  disableThrowOnError: boolean;
1242
1162
  /**
1243
1163
  * output only errors to console
1244
1164
  * @default false
1245
1165
  */
1246
- silent: boolean;
1247
- /** hooks for customising the generation process */
1248
- hooks: Partial<Hooks>;
1249
- /** use enum names as values */
1250
- enumNamesAsValues: boolean;
1251
- /** package version */
1252
- version: string;
1253
- /** ts compiler configuration object (for --to-js option) */
1254
- compilerTsConfig: Record<string, unknown>;
1255
- /** enum key resolver name */
1256
- enumKeyResolverName: string;
1257
- /** type name resolver name */
1258
- typeNameResolverName: string;
1259
- /** specific argument name resolver name */
1166
+ silent: boolean; /** hooks for customising the generation process */
1167
+ hooks: Partial<Hooks>; /** use enum names as values */
1168
+ enumNamesAsValues: boolean; /** package version */
1169
+ version: string; /** ts compiler configuration object (for --to-js option) */
1170
+ compilerTsConfig: Record<string, unknown>; /** enum key resolver name */
1171
+ enumKeyResolverName: string; /** type name resolver name */
1172
+ typeNameResolverName: string; /** specific argument name resolver name */
1260
1173
  specificArgNameResolverName: string;
1261
1174
  /**
1262
1175
  * custom ts->* translator
1263
1176
  * do not use constructor args, just send class reference
1264
1177
  */
1265
- customTranslator?: new () => Translator;
1266
- /** internal constants */
1267
- constants: typeof constants_d_exports;
1268
- /** code generation constructs for TypeScript */
1178
+ customTranslator?: new () => Translator; /** internal constants */
1179
+ constants: typeof constants_d_exports; /** code generation constructs for TypeScript */
1269
1180
  Ts: CodeGenConstruct;
1270
1181
  /**
1271
1182
  * swagger schema type -> typescript type
1272
1183
  * https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times
1273
1184
  */
1274
- primitiveTypes: PrimitiveTypeStruct;
1275
- /** built-in template info */
1185
+ primitiveTypes: PrimitiveTypeStruct; /** built-in template info */
1276
1186
  templateInfos: {
1277
1187
  name: string;
1278
1188
  fileName: string;
1279
- }[];
1280
- /** supported template file extensions */
1281
- templateExtensions: string[];
1282
- /** range of HTTP status codes treated as success */
1283
- successResponseStatusRange: [number, number];
1284
- /** custom schema parsers */
1189
+ }[]; /** supported template file extensions */
1190
+ templateExtensions: string[]; /** range of HTTP status codes treated as success */
1191
+ successResponseStatusRange: [number, number]; /** custom schema parsers */
1285
1192
  schemaParsers?: {
1286
1193
  complexOneOf?: MonoSchemaParser;
1287
1194
  complexAllOf?: MonoSchemaParser;
@@ -1293,21 +1200,17 @@ interface GenerateApiConfiguration {
1293
1200
  primitive?: MonoSchemaParser;
1294
1201
  discriminator?: MonoSchemaParser;
1295
1202
  array?: MonoSchemaParser;
1296
- };
1297
- /** internal options for templates */
1203
+ }; /** internal options for templates */
1298
1204
  internalTemplateOptions: {
1299
1205
  addUtilRequiredKeysType: boolean;
1300
- };
1301
- /** resolver for component type names */
1302
- componentTypeNameResolver: ComponentTypeNameResolver;
1303
- /** generated file names */
1206
+ }; /** resolver for component type names */
1207
+ componentTypeNameResolver: ComponentTypeNameResolver; /** generated file names */
1304
1208
  fileNames: {
1305
1209
  dataContracts: string;
1306
1210
  routeTypes: string;
1307
1211
  httpClient: string;
1308
1212
  outOfModuleApi: string;
1309
- };
1310
- /** Record<templateName, templateContent> */
1213
+ }; /** Record<templateName, templateContent> */
1311
1214
  templatesToRender: {
1312
1215
  api: string;
1313
1216
  dataContracts: string;
@@ -1319,16 +1222,11 @@ interface GenerateApiConfiguration {
1319
1222
  typeDataContract: string;
1320
1223
  enumDataContract: string;
1321
1224
  objectFieldJsDoc: string;
1322
- };
1323
- /** map of duplicate route names */
1324
- routeNameDuplicatesMap: Map<string, string>;
1325
- /** name of the main exported class */
1326
- apiClassName: string;
1327
- /** configuration for fetching swagger schema requests */
1328
- requestOptions?: Partial<RequestInit>;
1329
- /** extra configuration for extracting type names operations */
1330
- extractingOptions: Partial<ExtractingOptions>;
1331
- /** update configuration object during generation */
1225
+ }; /** map of duplicate route names */
1226
+ routeNameDuplicatesMap: Map<string, string>; /** name of the main exported class */
1227
+ apiClassName: string; /** configuration for fetching swagger schema requests */
1228
+ requestOptions?: Partial<RequestInit>; /** extra configuration for extracting type names operations */
1229
+ extractingOptions: Partial<ExtractingOptions>; /** update configuration object during generation */
1332
1230
  update: (update: Partial<GenerateApiConfiguration["config"]>) => void;
1333
1231
  };
1334
1232
  modelTypes: ModelType[];
@@ -1346,8 +1244,7 @@ interface GenerateApiConfiguration {
1346
1244
  requestOptions?: Partial<RequestInit>;
1347
1245
  utils: {
1348
1246
  formatDescription: (description: string, inline?: boolean) => string;
1349
- internalCase: (value: string) => string;
1350
- /** @deprecated */
1247
+ internalCase: (value: string) => string; /** @deprecated */
1351
1248
  classNameCase: (value: string) => string;
1352
1249
  pascalCase: (value: string) => string;
1353
1250
  getInlineParseContent: (rawTypeData: SchemaComponent["rawTypeData"], typeName?: string) => string;
@@ -1360,16 +1257,13 @@ interface GenerateApiConfiguration {
1360
1257
  fmtToJSDocLine: (line: string, params?: {
1361
1258
  eol?: boolean;
1362
1259
  }) => string;
1363
- _: lodash0.LoDashStatic;
1260
+ _: typeof es_toolkit0 & typeof es_toolkit_compat0;
1364
1261
  require: (path: string) => unknown;
1365
1262
  };
1366
1263
  }
1367
1264
  type FileInfo = {
1368
- /** @example myFilename */
1369
- fileName: string;
1370
- /** @example .d.ts */
1371
- fileExtension: string;
1372
- /** content of the file */
1265
+ /** @example myFilename */fileName: string; /** @example .d.ts */
1266
+ fileExtension: string; /** content of the file */
1373
1267
  fileContent: string;
1374
1268
  };
1375
1269
  interface GenerateApiOutput {
@@ -1381,7 +1275,7 @@ interface GenerateApiOutput {
1381
1275
  content: string;
1382
1276
  withPrefix: boolean;
1383
1277
  }) => void;
1384
- renderTemplate: (templateContent: string, data: Record<string, unknown>, etaOptions?: Partial<eta0.EtaConfig>) => Promise<string> | string;
1278
+ renderTemplate: (templateContent: string, data: Record<string, unknown>, etaOptions?: Partial<eta.EtaConfig>) => Promise<string> | string;
1385
1279
  getTemplate: (params: {
1386
1280
  fileName?: string;
1387
1281
  name?: string;
@@ -1453,15 +1347,10 @@ declare class CodeGenConfig {
1453
1347
  sortTypes: boolean;
1454
1348
  sortRoutes: boolean;
1455
1349
  templatePaths: {
1456
- /** `templates/base` */
1457
- base: string;
1458
- /** `templates/default` */
1459
- default: string;
1460
- /** `templates/modular` */
1461
- modular: string;
1462
- /** usage path if `--templates` option is not set */
1463
- original: string;
1464
- /** custom path to templates (`--templates`) */
1350
+ /** `templates/base` */base: string; /** `templates/default` */
1351
+ default: string; /** `templates/modular` */
1352
+ modular: string; /** usage path if `--templates` option is not set */
1353
+ original: string; /** custom path to templates (`--templates`) */
1465
1354
  custom: string;
1466
1355
  };
1467
1356
  /** Record<templateName, templateContent> */
@@ -1774,14 +1663,15 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1774
1663
  TypeWithGeneric: (typeName: unknown, genericArgs: unknown[]) => string;
1775
1664
  Tuple: (values: unknown[]) => string;
1776
1665
  };
1777
- formatDescription: (description: any, inline: any) => any;
1778
- internalCase: typeof internalCase;
1666
+ formatDescription: (description: string | undefined, inline?: boolean) => string;
1667
+ escapeJSDocContent: (content: unknown) => string;
1668
+ internalCase: typeof es_toolkit_compat0.camelCase;
1779
1669
  classNameCase: typeof pascalCase;
1780
1670
  pascalCase: typeof pascalCase;
1781
- getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
1782
- getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
1671
+ getInlineParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
1672
+ getParseContent: (schema: SchemaParserConfig["schema"], typeName: string | null, schemaPath: string[]) => Record<string, any>;
1783
1673
  getComponentByRef: ($ref: string) => SchemaComponent | null;
1784
- parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
1674
+ parseSchema: (schema: SchemaParserConfig["schema"], typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
1785
1675
  checkAndAddNull: (schema: any, type: any) => any;
1786
1676
  safeAddNullToType: (schema: any, type: any) => any;
1787
1677
  isNeedToAddNull: (schema: any, type: any) => any;
@@ -1803,7 +1693,7 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1803
1693
  eol?: boolean | undefined;
1804
1694
  }) => string;
1805
1695
  NameResolver: typeof NameResolver;
1806
- _: lodash0.LoDashStatic;
1696
+ _: Record<string, unknown>;
1807
1697
  require: (packageOrPath: string) => any;
1808
1698
  };
1809
1699
  };