openapi-ts-request 0.11.0 → 0.11.1
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.
|
@@ -172,7 +172,7 @@ class ServiceGenerator {
|
|
|
172
172
|
type: this.getType(parameter.schema),
|
|
173
173
|
});
|
|
174
174
|
});
|
|
175
|
-
const typeName = this.
|
|
175
|
+
const typeName = this.getFunctionParamsTypeName(Object.assign(Object.assign({}, operationObject), { method, path: pathKey }));
|
|
176
176
|
if (props.length > 0 && typeName) {
|
|
177
177
|
lastTypes.push({
|
|
178
178
|
typeName,
|
|
@@ -316,7 +316,7 @@ class ServiceGenerator {
|
|
|
316
316
|
};
|
|
317
317
|
return Object.assign(Object.assign({}, newApi), { functionName: this.config.isCamelCase
|
|
318
318
|
? (0, lodash_1.camelCase)(functionName)
|
|
319
|
-
: functionName, typeName: this.
|
|
319
|
+
: functionName, typeName: this.getFunctionParamsTypeName(newApi), path: getPrefixPath(), pathInComment: formattedPath.replace(/\*/g, '*'), apifoxRunLink: newApi === null || newApi === void 0 ? void 0 : newApi['x-run-in-apifox'], hasPathVariables: formattedPath.includes('{'), hasApiPrefix: !!this.config.apiPrefix, method: newApi.method,
|
|
320
320
|
// 如果 functionName 和 summary 相同,则不显示 summary
|
|
321
321
|
desc: functionName === newApi.summary
|
|
322
322
|
? (newApi.description || '').replace(config_1.lineBreakReg, '')
|
|
@@ -402,7 +402,7 @@ class ServiceGenerator {
|
|
|
402
402
|
}
|
|
403
403
|
return (0, util_1.getDefaultType)(schemaObject, namespace, schemas);
|
|
404
404
|
}
|
|
405
|
-
|
|
405
|
+
getFunctionParamsTypeName(data) {
|
|
406
406
|
var _a, _b, _c;
|
|
407
407
|
const namespace = this.config.namespace ? `${this.config.namespace}.` : '';
|
|
408
408
|
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);
|
|
@@ -592,12 +592,18 @@ class ServiceGenerator {
|
|
|
592
592
|
return schemaObject;
|
|
593
593
|
}
|
|
594
594
|
resolveArray(schemaObject) {
|
|
595
|
+
var _a;
|
|
595
596
|
if ((0, util_1.isReferenceObject)(schemaObject.items)) {
|
|
596
597
|
const refName = (0, util_1.getRefName)(schemaObject.items);
|
|
597
598
|
return {
|
|
598
599
|
type: `${refName}[]`,
|
|
599
600
|
};
|
|
600
601
|
}
|
|
602
|
+
else if ((_a = schemaObject.items) === null || _a === void 0 ? void 0 : _a.enum) {
|
|
603
|
+
return {
|
|
604
|
+
type: this.getType(schemaObject, this.config.namespace),
|
|
605
|
+
};
|
|
606
|
+
}
|
|
601
607
|
// 这里需要解析出具体属性,但由于 parser 层还不确定,所以暂时先返回 unknown[]
|
|
602
608
|
return { type: 'unknown[]' };
|
|
603
609
|
}
|
package/package.json
CHANGED