plugins
plugins copied to clipboard
[plugin-openapi] 生成的实体,不支持嵌套类型
"components": {
"schemas": {
"ComBaseWell": {
"type": "object",
"properties": {
"id": {
"type": "string",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"Test": {
"type": "object",
"properties": {
"comBaseWell": {
"$ref": "#/components/schemas/ComBaseWell"
},
"userDto": {
"$ref": "#/components/schemas/UserDto"
}
},
"additionalProperties": false
},
"UserDto": {
"type": "object",
"properties": {
"id": {
"type": "string",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
},
"age": {
"type": "integer",
"format": "int32"
},
"sex": {
"type": "boolean"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true
}
},
"additionalProperties": false
},
}
}
}
生成的types.d Test 没有下级内容
declare namespace API {
type ComBaseWell = {
id?: string;
name?: string;
};
type Test = ComBaseWell;
type UserDto = {
id?: string;
name?: string;
age?: number;
sex?: boolean;
tags?: string[];
};
type WeatherForecast = {
date?: string;
temperatureC?: number;
temperatureF?: number;
summary?: string;
};
}
正确的应该是 type Test = { comBaseWell:ComBaseWell , userDto:UserDto }
我也遇到了同样的问题 "@umijs/openapi": "^1.3.0", "@umijs/plugin-openapi": "^1.3.0",
-
将本地的版本 yarn remove 再 yarn add 最新版也出现这种情况 @umijs/openapi 实际版本都是 1.3.2 应该是包的依赖升级导致
-
当代码里有 下面代码会报错
"Map«string,List«***»»": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/List" }
},
找到的原因就是definitions/list does not exist
需要删除"$ref": "#/definitions/List"
才可以生成
希望能修复
"additionalProperties": { "$ref": "#/definitions/List" }
问一下,这个问题解决了吗,我也遇到了这个问题
新版本才出现的问题,可以回退到旧版本上使用
例如:
{
"devDependencies":{
// 省略其它依赖
"@umijs/openapi": "^1.3.0",
"@umijs/plugin-openapi": "^1.3.0"
},
"resolutions":{
"@umijs/openapi":"1.4.4"
}
}