openapi-ts-request 0.4.6 → 0.4.7
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.
|
@@ -79,11 +79,14 @@ class ServiceGenerator {
|
|
|
79
79
|
list: interfaceTPConfigs,
|
|
80
80
|
});
|
|
81
81
|
// 生成枚举翻译
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const enums = (0, lodash_1.filter)(interfaceTPConfigs, (item) => item.isEnum);
|
|
83
|
+
if (!(0, lodash_1.isEmpty)(enums)) {
|
|
84
|
+
this.genFileFromTemplate(`${config_1.displayEnumLabelFileName}.ts`, config_1.TypescriptFileType.displayEnumLabel, {
|
|
85
|
+
list: enums,
|
|
86
|
+
namespace: this.config.namespace,
|
|
87
|
+
interfaceFileName: config_1.interfaceFileName,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
87
90
|
// 生成 type 翻译
|
|
88
91
|
if (this.config.isDisplayTypeLabel) {
|
|
89
92
|
this.genFileFromTemplate(`${config_1.displayTypeLabelFileName}.ts`, config_1.TypescriptFileType.displayTypeLabel, {
|
|
@@ -206,7 +209,7 @@ class ServiceGenerator {
|
|
|
206
209
|
}
|
|
207
210
|
// 判断哪些 schema 需要添加进 type, schemas 渲染数组
|
|
208
211
|
if ((0, lodash_1.isEmpty)(this.config.allowedTags) ||
|
|
209
|
-
schema.isAllowed) {
|
|
212
|
+
(schema === null || schema === void 0 ? void 0 : schema.isAllowed)) {
|
|
210
213
|
const isEnum = result.isEnum;
|
|
211
214
|
const typeName = (0, util_1.resolveTypeName)(schemaKey);
|
|
212
215
|
lastTypes.push({
|
package/dist/generator/util.js
CHANGED
|
@@ -279,7 +279,7 @@ function markAllowSchema(schemaStr, schemas) {
|
|
|
279
279
|
(0, lodash_1.forEach)(refs, (ref) => {
|
|
280
280
|
const refPaths = ref.split('/');
|
|
281
281
|
const schema = schemas === null || schemas === void 0 ? void 0 : schemas[refPaths[refPaths.length - 1]];
|
|
282
|
-
if (
|
|
282
|
+
if (schema && !schema.isAllowed) {
|
|
283
283
|
schema.isAllowed = true;
|
|
284
284
|
markAllowSchema(JSON.stringify(schema), schemas);
|
|
285
285
|
}
|
package/package.json
CHANGED