swagger-typescript-api 13.2.4 → 13.2.6
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/CHANGELOG.md +12 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +6 -10
- package/dist/lib.d.ts +6 -11
- package/dist/lib.js +1 -1
- package/dist/{src-Dg3yZCMd.js → src-AKvd7SbK.js} +115 -83
- package/dist/src-AKvd7SbK.js.map +1 -0
- package/dist/{src-Dti-j_nt.cjs → src-CKol_ydn.cjs} +45 -20
- package/dist/src-CKol_ydn.cjs.map +1 -0
- package/package.json +5 -5
- package/templates/base/data-contract-jsdoc.ejs +1 -1
- package/dist/src-Dg3yZCMd.js.map +0 -1
- package/dist/src-Dti-j_nt.cjs.map +0 -1
|
@@ -181,7 +181,7 @@ const getRandomInt = (min = 0, max = 1) => {
|
|
|
181
181
|
var ComponentTypeNameResolver = class extends NameResolver {
|
|
182
182
|
counter = 1;
|
|
183
183
|
fallbackNameCounter = 1;
|
|
184
|
-
countersByVariant =
|
|
184
|
+
countersByVariant = new Map();
|
|
185
185
|
constructor(config, reservedNames) {
|
|
186
186
|
super(config, reservedNames, (variants) => {
|
|
187
187
|
const randomVariant = variants[getRandomInt(0, variants.length - 1)];
|
|
@@ -203,7 +203,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
203
203
|
//#endregion
|
|
204
204
|
//#region package.json
|
|
205
205
|
var name = "swagger-typescript-api";
|
|
206
|
-
var version = "13.2.
|
|
206
|
+
var version = "13.2.6";
|
|
207
207
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
208
208
|
var homepage = "https://github.com/acacode/swagger-typescript-api";
|
|
209
209
|
var bugs = "https://github.com/acacode/swagger-typescript-api/issues";
|
|
@@ -244,7 +244,7 @@ var scripts = {
|
|
|
244
244
|
};
|
|
245
245
|
var dependencies = {
|
|
246
246
|
"@biomejs/js-api": "1.0.0",
|
|
247
|
-
"@biomejs/wasm-nodejs": "2.0.
|
|
247
|
+
"@biomejs/wasm-nodejs": "2.0.5",
|
|
248
248
|
"@types/swagger-schema-official": "^2.0.25",
|
|
249
249
|
"c12": "^3.0.4",
|
|
250
250
|
"citty": "^0.1.6",
|
|
@@ -258,18 +258,18 @@ var dependencies = {
|
|
|
258
258
|
"typescript": "~5.8.3"
|
|
259
259
|
};
|
|
260
260
|
var devDependencies = {
|
|
261
|
-
"@biomejs/biome": "2.0.
|
|
261
|
+
"@biomejs/biome": "2.0.5",
|
|
262
262
|
"@changesets/changelog-github": "0.5.1",
|
|
263
263
|
"@changesets/cli": "2.29.5",
|
|
264
264
|
"@tsconfig/node18": "18.2.4",
|
|
265
265
|
"@tsconfig/strictest": "2.0.5",
|
|
266
266
|
"@types/js-yaml": "4.0.9",
|
|
267
267
|
"@types/lodash": "4.17.18",
|
|
268
|
-
"@types/node": "24.0.
|
|
268
|
+
"@types/node": "24.0.4",
|
|
269
269
|
"@types/swagger2openapi": "7.0.4",
|
|
270
270
|
"axios": "1.10.0",
|
|
271
271
|
"openapi-types": "12.1.3",
|
|
272
|
-
"tsdown": "0.12.
|
|
272
|
+
"tsdown": "0.12.9",
|
|
273
273
|
"typedoc": "0.28.5",
|
|
274
274
|
"vitest": "3.2.4"
|
|
275
275
|
};
|
|
@@ -452,7 +452,7 @@ var CodeGenConfig = class {
|
|
|
452
452
|
httpClient: "http-client",
|
|
453
453
|
outOfModuleApi: "Common"
|
|
454
454
|
};
|
|
455
|
-
routeNameDuplicatesMap =
|
|
455
|
+
routeNameDuplicatesMap = new Map();
|
|
456
456
|
hooks = {
|
|
457
457
|
onPreBuildRoutePath: (_routePath) => void 0,
|
|
458
458
|
onBuildRoutePath: (_routeData) => void 0,
|
|
@@ -1275,12 +1275,21 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
|
|
|
1275
1275
|
})
|
|
1276
1276
|
};
|
|
1277
1277
|
});
|
|
1278
|
-
if (additionalProperties)
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1278
|
+
if (additionalProperties) {
|
|
1279
|
+
const propertyNamesSchema = this.schemaUtils.getSchemaPropertyNamesSchema(schema);
|
|
1280
|
+
let interfaceKeysContent;
|
|
1281
|
+
if (propertyNamesSchema) interfaceKeysContent = this.schemaParserFabric.createSchemaParser({
|
|
1282
|
+
schema: propertyNamesSchema,
|
|
1283
|
+
schemaPath: this.schemaPath
|
|
1284
|
+
}).getInlineParseContent();
|
|
1285
|
+
else interfaceKeysContent = this.config.Ts.Keyword.String;
|
|
1286
|
+
propertiesContent.push({
|
|
1287
|
+
$$raw: { additionalProperties },
|
|
1288
|
+
description: "",
|
|
1289
|
+
isRequired: false,
|
|
1290
|
+
field: this.config.Ts.InterfaceDynamicField(interfaceKeysContent, this.config.Ts.Keyword.Any)
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1284
1293
|
return propertiesContent;
|
|
1285
1294
|
};
|
|
1286
1295
|
};
|
|
@@ -1292,11 +1301,20 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
|
|
|
1292
1301
|
let contentType = null;
|
|
1293
1302
|
const { additionalProperties, type: type$1, description: description$1, items } = this.schema || {};
|
|
1294
1303
|
if (type$1 === this.config.Ts.Keyword.Object && additionalProperties) {
|
|
1295
|
-
const
|
|
1304
|
+
const propertyNamesSchema = this.schemaUtils.getSchemaPropertyNamesSchema(this.schema);
|
|
1305
|
+
let recordKeysContent;
|
|
1306
|
+
let recordValuesContent;
|
|
1307
|
+
if (propertyNamesSchema) recordKeysContent = this.schemaParserFabric.createSchemaParser({
|
|
1308
|
+
schema: propertyNamesSchema,
|
|
1309
|
+
schemaPath: this.schemaPath
|
|
1310
|
+
}).getInlineParseContent();
|
|
1311
|
+
else recordKeysContent = this.config.Ts.Keyword.String;
|
|
1312
|
+
if (typeof additionalProperties === "object") recordValuesContent = this.schemaParserFabric.createSchemaParser({
|
|
1296
1313
|
schema: additionalProperties,
|
|
1297
1314
|
schemaPath: this.schemaPath
|
|
1298
|
-
}).getInlineParseContent()
|
|
1299
|
-
|
|
1315
|
+
}).getInlineParseContent();
|
|
1316
|
+
else recordValuesContent = this.config.Ts.Keyword.Any;
|
|
1317
|
+
contentType = this.config.Ts.RecordType(recordKeysContent, recordValuesContent);
|
|
1300
1318
|
}
|
|
1301
1319
|
if (Array.isArray(type$1) && type$1.length) contentType = this.schemaParser._complexSchemaParsers.oneOf({
|
|
1302
1320
|
...typeof this.schema === "object" ? this.schema : {},
|
|
@@ -1537,6 +1555,10 @@ var SchemaUtils = class {
|
|
|
1537
1555
|
getEnumDescriptions = (schema) => {
|
|
1538
1556
|
return schema["x-enumDescriptions"] || schema.xEnumDescriptions || schema["x-enumdescriptions"] || schema["x-enum-descriptions"];
|
|
1539
1557
|
};
|
|
1558
|
+
getSchemaPropertyNamesSchema = (schema) => {
|
|
1559
|
+
if (!schema) return null;
|
|
1560
|
+
return schema.propertyNames || schema["x-propertyNames"] || null;
|
|
1561
|
+
};
|
|
1540
1562
|
getSchemaRefType = (schema) => {
|
|
1541
1563
|
if (!this.isRefSchema(schema)) return null;
|
|
1542
1564
|
return this.schemaComponentsMap.get(schema.$ref);
|
|
@@ -2040,7 +2062,9 @@ var SchemaRoutes = class {
|
|
|
2040
2062
|
if (schema?.typeData) schema.typeData.isExtractedRequestBody = true;
|
|
2041
2063
|
content = this.schemaParserFabric.getInlineParseContent({ $ref: schema.$ref });
|
|
2042
2064
|
}
|
|
2065
|
+
if (schema && schema.typeData && !schema.typeData.description && requestBody?.description) schema.typeData.description = requestBody.description;
|
|
2043
2066
|
return {
|
|
2067
|
+
...requestBody || {},
|
|
2044
2068
|
paramName: requestBodyName || requestBody?.name || DEFAULT_BODY_ARG_NAME,
|
|
2045
2069
|
contentTypes,
|
|
2046
2070
|
contentKind,
|
|
@@ -2222,6 +2246,7 @@ var SchemaRoutes = class {
|
|
|
2222
2246
|
type: queryType
|
|
2223
2247
|
} : void 0,
|
|
2224
2248
|
body: requestBodyInfo.type ? {
|
|
2249
|
+
...requestBodyInfo,
|
|
2225
2250
|
name: nameResolver.resolve([requestBodyInfo.paramName, ...RESERVED_BODY_ARG_NAMES]),
|
|
2226
2251
|
optional: !requestBodyInfo.required,
|
|
2227
2252
|
type: requestBodyInfo.type
|
|
@@ -2342,8 +2367,8 @@ var SchemaRoutes = class {
|
|
|
2342
2367
|
var SchemaWalker = class {
|
|
2343
2368
|
config;
|
|
2344
2369
|
swaggerSchemaResolver;
|
|
2345
|
-
schemas =
|
|
2346
|
-
caches =
|
|
2370
|
+
schemas = new Map();
|
|
2371
|
+
caches = new Map();
|
|
2347
2372
|
constructor(config, swaggerSchemaResolver) {
|
|
2348
2373
|
this.config = config;
|
|
2349
2374
|
this.swaggerSchemaResolver = swaggerSchemaResolver;
|
|
@@ -2632,7 +2657,7 @@ var JavascriptTranslator = class extends Translator {
|
|
|
2632
2657
|
//#endregion
|
|
2633
2658
|
//#region src/type-name-formatter.ts
|
|
2634
2659
|
var TypeNameFormatter = class {
|
|
2635
|
-
formattedModelNamesMap =
|
|
2660
|
+
formattedModelNamesMap = new Map();
|
|
2636
2661
|
config;
|
|
2637
2662
|
constructor(config) {
|
|
2638
2663
|
this.config = config;
|
|
@@ -3210,4 +3235,4 @@ Object.defineProperty(exports, 'package_default', {
|
|
|
3210
3235
|
return package_default;
|
|
3211
3236
|
}
|
|
3212
3237
|
});
|
|
3213
|
-
//# sourceMappingURL=src-
|
|
3238
|
+
//# sourceMappingURL=src-CKol_ydn.cjs.map
|