echoapi-converter 0.0.85 → 0.0.86

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2140,6 +2140,13 @@ const deepModelRef = (originSchema, schemaMap, startSchema, count = 0) => {
2140
2140
  mapSchema = deepModelRef(mapValue === null || mapValue === void 0 ? void 0 : mapValue.schema, schemaMap, startSchema || originSchema, ++deepCount);
2141
2141
  }
2142
2142
  }
2143
+ if (lodash.isArray(mapSchema === null || mapSchema === void 0 ? void 0 : mapSchema.required)) {
2144
+ schema.required = mapSchema.required.reduce((lastRequired, item) => {
2145
+ if (!lodash.includes(lastRequired, item)) {
2146
+ lastRequired.push(item);
2147
+ }
2148
+ }, (schema === null || schema === void 0 ? void 0 : schema.required) || []);
2149
+ }
2143
2150
  pre = Object.assign(Object.assign({}, pre), ((mapSchema === null || mapSchema === void 0 ? void 0 : mapSchema.properties) || {}));
2144
2151
  }
2145
2152
  if (lodash.isEqual(startSchema || originSchema, (_b = schemaMap[refId]) === null || _b === void 0 ? void 0 : _b.schema)) {
@@ -2544,7 +2551,13 @@ const handlePathItemRequestBody = (body, pathItem, modelsObj) => {
2544
2551
  lastData[item.key] = Object.assign({ type: ((_a = item === null || item === void 0 ? void 0 : item.field_type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || 'string', description: (item === null || item === void 0 ? void 0 : item.description) || "", example: (item === null || item === void 0 ? void 0 : item.value) || "" }, (lodash.isPlainObject(item === null || item === void 0 ? void 0 : item.schema) ? item.schema : {}));
2545
2552
  }
2546
2553
  return lastData;
2547
- }, {})
2554
+ }, {}),
2555
+ required: parameter.reduce((lastArr, item) => {
2556
+ if (lodash.isEqual(item === null || item === void 0 ? void 0 : item.not_null, 1) && !lodash.includes(lastArr, item.key)) {
2557
+ lastArr.push(item.key);
2558
+ }
2559
+ return lastArr;
2560
+ }, [])
2548
2561
  },
2549
2562
  };
2550
2563
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-converter",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "description": "echoapi to swagger",
5
5
  "main": "dist/index.js",
6
6
  "files": [