openapi-ts-request 1.6.0 → 1.6.2

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.
@@ -361,6 +361,7 @@ class ServiceGenerator {
361
361
  ? (0, util_1.camelCase)(`display-${typeName}-Enum`)
362
362
  : '',
363
363
  enumLabelType: isEnum ? result.enumLabelType : '',
364
+ description: result.description,
364
365
  });
365
366
  }
366
367
  if (this.config.isGenJsonSchemas) {
@@ -387,7 +388,8 @@ class ServiceGenerator {
387
388
  const newApi = api;
388
389
  try {
389
390
  const params = this.getParamsTP(newApi.parameters, newApi.path) || {};
390
- const body = this.getBodyTP(newApi.requestBody);
391
+ const body = this.getBodyTP(newApi.requestBody, this.config.namespace);
392
+ const bodyWithoutNamespace = this.getBodyTP(newApi.requestBody);
391
393
  const response = this.getResponseTP(newApi.responses);
392
394
  const file = this.getFileTP(newApi.requestBody);
393
395
  let formData = false;
@@ -405,7 +407,7 @@ class ServiceGenerator {
405
407
  const bodyName = (0, lodash_1.upperFirst)(`${functionName}Body`);
406
408
  this.interfaceTPConfigs.push({
407
409
  typeName: bodyName,
408
- type: body === null || body === void 0 ? void 0 : body.type,
410
+ type: bodyWithoutNamespace === null || bodyWithoutNamespace === void 0 ? void 0 : bodyWithoutNamespace.type,
409
411
  isEnum: false,
410
412
  props: [],
411
413
  });
@@ -584,7 +586,7 @@ class ServiceGenerator {
584
586
  const typeName = ((_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.hook) === null || _b === void 0 ? void 0 : _b.customTypeName) === null || _c === void 0 ? void 0 : _c.call(_b, data)) || this.getFunctionName(data);
585
587
  return (0, util_2.resolveTypeName)(`${namespace}${typeName !== null && typeName !== void 0 ? typeName : data.operationId}Params`);
586
588
  }
587
- getBodyTP(requestBody) {
589
+ getBodyTP(requestBody, namespace) {
588
590
  var _a;
589
591
  const reqBody = this.resolveRefObject(requestBody);
590
592
  if ((0, lodash_1.isEmpty)(reqBody)) {
@@ -604,14 +606,11 @@ class ServiceGenerator {
604
606
  const bodySchema = {
605
607
  mediaType,
606
608
  required,
607
- type: this.getType(schema, this.config.namespace),
609
+ type: this.getType(schema, namespace),
608
610
  isAnonymous: false,
609
611
  };
610
- // 具名 body 场景
611
- if ((0, util_2.isReferenceObject)(schema)) {
612
- bodySchema.type = `${bodySchema.type}`;
613
- }
614
- else {
612
+ // 匿名 body 场景
613
+ if (!(0, util_2.isReferenceObject)(schema)) {
615
614
  bodySchema.isAnonymous = true;
616
615
  }
617
616
  return bodySchema;
@@ -687,7 +686,7 @@ class ServiceGenerator {
687
686
  resContent[mediaType].schema ||
688
687
  config_2.DEFAULT_SCHEMA);
689
688
  }
690
- responseSchema.type = `${this.getType(schema, this.config.namespace)}`;
689
+ responseSchema.type = this.getType(schema, this.config.namespace);
691
690
  return responseSchema;
692
691
  }
693
692
  if ((0, util_2.isSchemaObject)(schema)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-ts-request",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas",
5
5
  "engines": {
6
6
  "node": ">=18.0.0",
@@ -58,7 +58,7 @@
58
58
  "@types/lodash": "^4.17.5",
59
59
  "@types/memoizee": "^0.4.11",
60
60
  "@types/mockjs": "^1.0.10",
61
- "@types/node": "^22.15.17",
61
+ "@types/node": "^24.0.14",
62
62
  "@types/nunjucks": "^3.2.6",
63
63
  "@types/reserved-words": "^0.1.4",
64
64
  "@types/swagger2openapi": "^7.0.4",