Open phpmaple opened 2 years ago
文件发出来看看
// ============= paths =============
"/base-server/api/assetsUsageRecord/{id}": {
"get": {
"tags": [
"assets-usage-record-api"
],
"summary": "get",
"operationId": "getUsingGET_1",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"originalRef": "DataResult«AssetsUsageRecordVo»",
"$ref": "#/definitions/DataResult«AssetsUsageRecordVo»"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
}
/** 错误:
cloud-ui/node_modules/@umijs/openapi/dist/openAPIParserMock/index.js:29
if (name.toLocaleLowerCase().endsWith('id')) {
^
RangeError: Maximum call stack size exceeded
at String.endsWith (<anonymous>)
at getDateByName (cloud-ui/node_modules/@umijs/openapi/dist/openAPIParserMock/index.js:29:34)
*/
找到原因了,我的是因为这个报错
"produces": [
"application/json"
]
改成以下即可
"produces": [
"*/*"
],
生成的mock文件没有返回值,都是空对象 {}
这个应该是接口定义无限级联的情况,比如后端定义结构体 model.Response,里面有个字段的定义是model.Response,现实情况可能会比这复杂,比如a->b->c->a