echoapi-converter 0.0.85 → 0.0.87

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 +15 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2140,6 +2140,14 @@ 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
+ return lastRequired;
2149
+ }, (schema === null || schema === void 0 ? void 0 : schema.required) || []);
2150
+ }
2143
2151
  pre = Object.assign(Object.assign({}, pre), ((mapSchema === null || mapSchema === void 0 ? void 0 : mapSchema.properties) || {}));
2144
2152
  }
2145
2153
  if (lodash.isEqual(startSchema || originSchema, (_b = schemaMap[refId]) === null || _b === void 0 ? void 0 : _b.schema)) {
@@ -2544,7 +2552,13 @@ const handlePathItemRequestBody = (body, pathItem, modelsObj) => {
2544
2552
  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
2553
  }
2546
2554
  return lastData;
2547
- }, {})
2555
+ }, {}),
2556
+ required: parameter.reduce((lastArr, item) => {
2557
+ if (lodash.isEqual(item === null || item === void 0 ? void 0 : item.not_null, 1) && !lodash.includes(lastArr, item.key)) {
2558
+ lastArr.push(item.key);
2559
+ }
2560
+ return lastArr;
2561
+ }, [])
2548
2562
  },
2549
2563
  };
2550
2564
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-converter",
3
- "version": "0.0.85",
3
+ "version": "0.0.87",
4
4
  "description": "echoapi to swagger",
5
5
  "main": "dist/index.js",
6
6
  "files": [