swagger-typescript-api 13.2.2 → 13.2.4
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 +13 -4
- package/dist/lib.d.ts +13 -4
- package/dist/lib.js +1 -1
- package/dist/{src-CuoIgJ3d.js → src-Dg3yZCMd.js} +91 -85
- package/dist/src-Dg3yZCMd.js.map +1 -0
- package/dist/{src-DD5StS7t.cjs → src-Dti-j_nt.cjs} +28 -15
- package/dist/src-Dti-j_nt.cjs.map +1 -0
- package/package.json +9 -9
- package/templates/base/enum-data-contract.ejs +7 -1
- package/dist/src-CuoIgJ3d.js.map +0 -1
- package/dist/src-DD5StS7t.cjs.map +0 -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.4";
|
|
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";
|
|
@@ -243,8 +243,8 @@ var scripts = {
|
|
|
243
243
|
"typedoc": "typedoc"
|
|
244
244
|
};
|
|
245
245
|
var dependencies = {
|
|
246
|
-
"@biomejs/js-api": "0.
|
|
247
|
-
"@biomejs/wasm-nodejs": "2.0.
|
|
246
|
+
"@biomejs/js-api": "1.0.0",
|
|
247
|
+
"@biomejs/wasm-nodejs": "2.0.4",
|
|
248
248
|
"@types/swagger-schema-official": "^2.0.25",
|
|
249
249
|
"c12": "^3.0.4",
|
|
250
250
|
"citty": "^0.1.6",
|
|
@@ -258,20 +258,20 @@ var dependencies = {
|
|
|
258
258
|
"typescript": "~5.8.3"
|
|
259
259
|
};
|
|
260
260
|
var devDependencies = {
|
|
261
|
-
"@biomejs/biome": "2.0.
|
|
261
|
+
"@biomejs/biome": "2.0.4",
|
|
262
262
|
"@changesets/changelog-github": "0.5.1",
|
|
263
|
-
"@changesets/cli": "2.29.
|
|
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
|
-
"@types/lodash": "4.17.
|
|
268
|
-
"@types/node": "24.0.
|
|
267
|
+
"@types/lodash": "4.17.18",
|
|
268
|
+
"@types/node": "24.0.3",
|
|
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.8",
|
|
273
273
|
"typedoc": "0.28.5",
|
|
274
|
-
"vitest": "3.2.
|
|
274
|
+
"vitest": "3.2.4"
|
|
275
275
|
};
|
|
276
276
|
var packageManager = "yarn@4.9.2";
|
|
277
277
|
var engines = { "node": ">=20" };
|
|
@@ -601,7 +601,13 @@ var CodeGenConfig = class {
|
|
|
601
601
|
InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`,
|
|
602
602
|
EnumUsageKey: (enumStruct, key) => `${enumStruct}.${key}`,
|
|
603
603
|
EnumField: (key, value) => `${key} = ${value}`,
|
|
604
|
-
|
|
604
|
+
EnumFieldDescription: (description$1) => {
|
|
605
|
+
if (description$1) return ` /** ${description$1} */`;
|
|
606
|
+
else return "";
|
|
607
|
+
},
|
|
608
|
+
EnumFieldsWrapper: (contents) => lodash.default.map(contents, ({ key, value, description: description$1 }) => {
|
|
609
|
+
return [this.Ts.EnumFieldDescription(description$1), ` ${this.Ts.EnumField(key, value)}`].filter(Boolean).join("\n");
|
|
610
|
+
}).join(",\n"),
|
|
605
611
|
ObjectWrapper: (content) => `{\n${content}\n}`,
|
|
606
612
|
MultilineComment: (contents, formatFn) => [...contents.length === 1 ? [`/** ${contents[0]} */`] : [
|
|
607
613
|
"/**",
|
|
@@ -1165,6 +1171,7 @@ var EnumSchemaParser = class extends MonoSchemaParser {
|
|
|
1165
1171
|
})) }, this.typeName, this.schemaPath);
|
|
1166
1172
|
const keyType = this.schemaUtils.getSchemaType(this.schema);
|
|
1167
1173
|
const enumNames = this.schemaUtils.getEnumNames(this.schema);
|
|
1174
|
+
const enumDescriptions = this.schemaUtils.getEnumDescriptions(this.schema);
|
|
1168
1175
|
let content = null;
|
|
1169
1176
|
const formatValue = (value) => {
|
|
1170
1177
|
if (value === null) return this.config.Ts.NullValue(value);
|
|
@@ -1181,19 +1188,22 @@ var EnumSchemaParser = class extends MonoSchemaParser {
|
|
|
1181
1188
|
if (this.config.enumNamesAsValues || enumValue === void 0) return {
|
|
1182
1189
|
key: formattedKey,
|
|
1183
1190
|
type: this.config.Ts.Keyword.String,
|
|
1184
|
-
value: this.config.Ts.StringValue(enumName)
|
|
1191
|
+
value: this.config.Ts.StringValue(enumName),
|
|
1192
|
+
description: enumDescriptions?.[index]
|
|
1185
1193
|
};
|
|
1186
1194
|
return {
|
|
1187
1195
|
key: formattedKey,
|
|
1188
1196
|
type: keyType,
|
|
1189
|
-
value: formatValue(enumValue)
|
|
1197
|
+
value: formatValue(enumValue),
|
|
1198
|
+
description: enumDescriptions?.[index]
|
|
1190
1199
|
};
|
|
1191
1200
|
});
|
|
1192
|
-
else content = this.schema.enum.map((value) => {
|
|
1201
|
+
else content = this.schema.enum.map((value, index) => {
|
|
1193
1202
|
return {
|
|
1194
1203
|
key: this.formatEnumKey({ value }),
|
|
1195
1204
|
type: keyType,
|
|
1196
|
-
value: formatValue(value)
|
|
1205
|
+
value: formatValue(value),
|
|
1206
|
+
description: enumDescriptions?.[index]
|
|
1197
1207
|
};
|
|
1198
1208
|
});
|
|
1199
1209
|
return {
|
|
@@ -1524,6 +1534,9 @@ var SchemaUtils = class {
|
|
|
1524
1534
|
getEnumNames = (schema) => {
|
|
1525
1535
|
return schema["x-enumNames"] || schema.xEnumNames || schema["x-enumnames"] || schema["x-enum-varnames"];
|
|
1526
1536
|
};
|
|
1537
|
+
getEnumDescriptions = (schema) => {
|
|
1538
|
+
return schema["x-enumDescriptions"] || schema.xEnumDescriptions || schema["x-enumdescriptions"] || schema["x-enum-descriptions"];
|
|
1539
|
+
};
|
|
1527
1540
|
getSchemaRefType = (schema) => {
|
|
1528
1541
|
if (!this.isRefSchema(schema)) return null;
|
|
1529
1542
|
return this.schemaComponentsMap.get(schema.$ref);
|
|
@@ -3197,4 +3210,4 @@ Object.defineProperty(exports, 'package_default', {
|
|
|
3197
3210
|
return package_default;
|
|
3198
3211
|
}
|
|
3199
3212
|
});
|
|
3200
|
-
//# sourceMappingURL=src-
|
|
3213
|
+
//# sourceMappingURL=src-Dti-j_nt.cjs.map
|