swagger-typescript-api 13.2.4 → 13.2.5
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 +6 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +1 -0
- package/dist/lib.d.ts +1 -0
- package/dist/lib.js +1 -1
- package/dist/{src-Dti-j_nt.cjs → src-B15eFEWm.cjs} +35 -13
- package/dist/src-B15eFEWm.cjs.map +1 -0
- package/dist/{src-Dg3yZCMd.js → src-DW0ilIpJ.js} +35 -13
- package/dist/src-DW0ilIpJ.js.map +1 -0
- package/package.json +3 -3
- package/dist/src-Dg3yZCMd.js.map +0 -1
- package/dist/src-Dti-j_nt.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# swagger-typescript-api
|
|
2
2
|
|
|
3
|
+
## 13.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1302](https://github.com/acacode/swagger-typescript-api/pull/1302) [`790fece`](https://github.com/acacode/swagger-typescript-api/commit/790fecea92920ecc996d90dbad5a984421e16aa8) Thanks [@js2me](https://github.com/js2me)! - added support x-propertyNames, propertyNames for object types
|
|
8
|
+
|
|
3
9
|
## 13.2.4
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-B15eFEWm.cjs');
|
|
3
3
|
const node_path = require_src.__toESM(require("node:path"));
|
|
4
4
|
const c12 = require_src.__toESM(require("c12"));
|
|
5
5
|
const citty = require_src.__toESM(require("citty"));
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-
|
|
2
|
+
import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-DW0ilIpJ.js";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import { loadConfig } from "c12";
|
|
5
5
|
import { defineCommand, runMain } from "citty";
|
package/dist/lib.cjs
CHANGED
package/dist/lib.d.cts
CHANGED
|
@@ -137,6 +137,7 @@ declare class SchemaUtils {
|
|
|
137
137
|
isRefSchema: (schema: any) => boolean;
|
|
138
138
|
getEnumNames: (schema: any) => any;
|
|
139
139
|
getEnumDescriptions: (schema: any) => any;
|
|
140
|
+
getSchemaPropertyNamesSchema: (schema: any) => any;
|
|
140
141
|
getSchemaRefType: (schema: any) => SchemaComponent | null;
|
|
141
142
|
isPropertyRequired: (name: any, propertySchema: any, rootSchema: any) => any;
|
|
142
143
|
isNullMissingInType: (schema: any, type: any) => any;
|
package/dist/lib.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ declare class SchemaUtils {
|
|
|
136
136
|
isRefSchema: (schema: any) => boolean;
|
|
137
137
|
getEnumNames: (schema: any) => any;
|
|
138
138
|
getEnumDescriptions: (schema: any) => any;
|
|
139
|
+
getSchemaPropertyNamesSchema: (schema: any) => any;
|
|
139
140
|
getSchemaRefType: (schema: any) => SchemaComponent | null;
|
|
140
141
|
isPropertyRequired: (name: any, propertySchema: any, rootSchema: any) => any;
|
|
141
142
|
isNullMissingInType: (schema: any, type: any) => any;
|
package/dist/lib.js
CHANGED
|
@@ -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.5";
|
|
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,7 +258,7 @@ 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",
|
|
@@ -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);
|
|
@@ -3210,4 +3232,4 @@ Object.defineProperty(exports, 'package_default', {
|
|
|
3210
3232
|
return package_default;
|
|
3211
3233
|
}
|
|
3212
3234
|
});
|
|
3213
|
-
//# sourceMappingURL=src-
|
|
3235
|
+
//# sourceMappingURL=src-B15eFEWm.cjs.map
|