We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用 Ant Design Pro 生成 Swagger 对应的前端代码时,发现 Long 类型在 Swagger 中被生成为 string 类型的前端代码 比如下面id和userId给生成成了string类型
type InterfaceInfoVO = { createTime?: string; description?: string; id?: string; isDeleted?: number; method?: string; name?: string; requestHeader?: string; requestParams?: string; responseHeader?: string; sdkToken?: string; status?: number; totalNum?: number; updateTime?: string; url?: string; userId?: string; };
"InterfaceInfoVO": { "title": "InterfaceInfoVO", "type": "object", "properties": { "createTime": { "type": "string", "format": "date-time" }, "description": { "type": "string" }, "id": { "type": "integer", "format": "int64" }, "isDeleted": { "type": "integer", "format": "int32" }, "method": { "type": "string" }, "name": { "type": "string" }, "requestHeader": { "type": "string" }, "requestParams": { "type": "string" }, "responseHeader": { "type": "string" }, "sdkToken": { "type": "string" }, "status": { "type": "integer", "format": "int32" }, "totalNum": { "type": "integer", "format": "int32" }, "updateTime": { "type": "string", "format": "date-time" }, "url": { "type": "string" }, "userId": { "type": "integer", "format": "int64" } } },
The text was updated successfully, but these errors were encountered:
用的ant design pro v6.0.0
Sorry, something went wrong.
+1
这个问题是关于 openAPI 中的数据类型映射的问题。根据你提供的代码和问题描述,你的 InterfaceInfoVO 类型中的 id 和 userId 字段在 Swagger 中被定义为 integer 类型,并且使用了 format 属性指定了 int64 格式。然而,在生成的前端代码中,这两个字段被生成成了 string 类型。
InterfaceInfoVO
id
userId
integer
format
int64
string
这个是因为前端是没办法处理 int64 这么大的数字,为了简单处理转化成了 string
你好,请问解决了吗
No branches or pull requests
🐛 bug 描述
使用 Ant Design Pro 生成 Swagger 对应的前端代码时,发现 Long 类型在 Swagger 中被生成为 string 类型的前端代码
比如下面id和userId给生成成了string类型
📷 复现步骤 | Recurrence steps
type InterfaceInfoVO = {
createTime?: string;
description?: string;
id?: string;
isDeleted?: number;
method?: string;
name?: string;
requestHeader?: string;
requestParams?: string;
responseHeader?: string;
sdkToken?: string;
status?: number;
totalNum?: number;
updateTime?: string;
url?: string;
userId?: string;
};
"InterfaceInfoVO": {
"title": "InterfaceInfoVO",
"type": "object",
"properties": {
"createTime": {
"type": "string",
"format": "date-time"
},
"description": {
"type": "string"
},
"id": {
"type": "integer",
"format": "int64"
},
"isDeleted": {
"type": "integer",
"format": "int32"
},
"method": {
"type": "string"
},
"name": {
"type": "string"
},
"requestHeader": {
"type": "string"
},
"requestParams": {
"type": "string"
},
"responseHeader": {
"type": "string"
},
"sdkToken": {
"type": "string"
},
"status": {
"type": "integer",
"format": "int32"
},
"totalNum": {
"type": "integer",
"format": "int32"
},
"updateTime": {
"type": "string",
"format": "date-time"
},
"url": {
"type": "string"
},
"userId": {
"type": "integer",
"format": "int64"
}
}
},
The text was updated successfully, but these errors were encountered: