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.
@@ -177,7 +177,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
177
177
  //#endregion
178
178
  //#region package.json
179
179
  var name = "swagger-typescript-api";
180
- var version = "13.2.4";
180
+ var version = "13.2.5";
181
181
  var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
182
182
  var homepage = "https://github.com/acacode/swagger-typescript-api";
183
183
  var bugs = "https://github.com/acacode/swagger-typescript-api/issues";
@@ -218,7 +218,7 @@ var scripts = {
218
218
  };
219
219
  var dependencies = {
220
220
  "@biomejs/js-api": "1.0.0",
221
- "@biomejs/wasm-nodejs": "2.0.4",
221
+ "@biomejs/wasm-nodejs": "2.0.5",
222
222
  "@types/swagger-schema-official": "^2.0.25",
223
223
  "c12": "^3.0.4",
224
224
  "citty": "^0.1.6",
@@ -232,7 +232,7 @@ var dependencies = {
232
232
  "typescript": "~5.8.3"
233
233
  };
234
234
  var devDependencies = {
235
- "@biomejs/biome": "2.0.4",
235
+ "@biomejs/biome": "2.0.5",
236
236
  "@changesets/changelog-github": "0.5.1",
237
237
  "@changesets/cli": "2.29.5",
238
238
  "@tsconfig/node18": "18.2.4",
@@ -1249,12 +1249,21 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
1249
1249
  })
1250
1250
  };
1251
1251
  });
1252
- if (additionalProperties) propertiesContent.push({
1253
- $$raw: { additionalProperties },
1254
- description: "",
1255
- isRequired: false,
1256
- field: this.config.Ts.InterfaceDynamicField(this.config.Ts.Keyword.String, this.config.Ts.Keyword.Any)
1257
- });
1252
+ if (additionalProperties) {
1253
+ const propertyNamesSchema = this.schemaUtils.getSchemaPropertyNamesSchema(schema);
1254
+ let interfaceKeysContent;
1255
+ if (propertyNamesSchema) interfaceKeysContent = this.schemaParserFabric.createSchemaParser({
1256
+ schema: propertyNamesSchema,
1257
+ schemaPath: this.schemaPath
1258
+ }).getInlineParseContent();
1259
+ else interfaceKeysContent = this.config.Ts.Keyword.String;
1260
+ propertiesContent.push({
1261
+ $$raw: { additionalProperties },
1262
+ description: "",
1263
+ isRequired: false,
1264
+ field: this.config.Ts.InterfaceDynamicField(interfaceKeysContent, this.config.Ts.Keyword.Any)
1265
+ });
1266
+ }
1258
1267
  return propertiesContent;
1259
1268
  };
1260
1269
  };
@@ -1266,11 +1275,20 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
1266
1275
  let contentType = null;
1267
1276
  const { additionalProperties, type: type$1, description: description$1, items } = this.schema || {};
1268
1277
  if (type$1 === this.config.Ts.Keyword.Object && additionalProperties) {
1269
- const fieldType = typeof additionalProperties === "object" ? this.schemaParserFabric.createSchemaParser({
1278
+ const propertyNamesSchema = this.schemaUtils.getSchemaPropertyNamesSchema(this.schema);
1279
+ let recordKeysContent;
1280
+ let recordValuesContent;
1281
+ if (propertyNamesSchema) recordKeysContent = this.schemaParserFabric.createSchemaParser({
1282
+ schema: propertyNamesSchema,
1283
+ schemaPath: this.schemaPath
1284
+ }).getInlineParseContent();
1285
+ else recordKeysContent = this.config.Ts.Keyword.String;
1286
+ if (typeof additionalProperties === "object") recordValuesContent = this.schemaParserFabric.createSchemaParser({
1270
1287
  schema: additionalProperties,
1271
1288
  schemaPath: this.schemaPath
1272
- }).getInlineParseContent() : this.config.Ts.Keyword.Any;
1273
- contentType = this.config.Ts.RecordType(this.config.Ts.Keyword.String, fieldType);
1289
+ }).getInlineParseContent();
1290
+ else recordValuesContent = this.config.Ts.Keyword.Any;
1291
+ contentType = this.config.Ts.RecordType(recordKeysContent, recordValuesContent);
1274
1292
  }
1275
1293
  if (Array.isArray(type$1) && type$1.length) contentType = this.schemaParser._complexSchemaParsers.oneOf({
1276
1294
  ...typeof this.schema === "object" ? this.schema : {},
@@ -1511,6 +1529,10 @@ var SchemaUtils = class {
1511
1529
  getEnumDescriptions = (schema) => {
1512
1530
  return schema["x-enumDescriptions"] || schema.xEnumDescriptions || schema["x-enumdescriptions"] || schema["x-enum-descriptions"];
1513
1531
  };
1532
+ getSchemaPropertyNamesSchema = (schema) => {
1533
+ if (!schema) return null;
1534
+ return schema.propertyNames || schema["x-propertyNames"] || null;
1535
+ };
1514
1536
  getSchemaRefType = (schema) => {
1515
1537
  if (!this.isRefSchema(schema)) return null;
1516
1538
  return this.schemaComponentsMap.get(schema.$ref);
@@ -3137,4 +3159,4 @@ async function generateApi(config) {
3137
3159
 
3138
3160
  //#endregion
3139
3161
  export { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, constants_exports, generateApi, generateTemplates, package_default };
3140
- //# sourceMappingURL=src-Dg3yZCMd.js.map
3162
+ //# sourceMappingURL=src-DW0ilIpJ.js.map