openapi 转化出来的response类型都是object
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 251
- PR merge metrics
- No merged PRs in 30d
Description
## What happens(发生了什么)?
接口返回的json文件
{
"openapi": "3.0.1",
"info": { "description": "manageSwagger端接口文档", "version": "1.0.0", "title": "manageSwagger端接口文档" },
"servers": [
{ "url": "http://localhost:3000", "description": "本地测试地址" },
{ "url": "http://test0.platform.ifengidc.com/platform/server", "description": "测试地址" },
{ "url": "http://platform.ifengidc.com/platform/server", "description": "正式地址" }
],
"tags": [{ "name": "全部", "description": "api" }],
"paths": {
"/api/swaggerDiffCreate": {
"post": {
"tags": ["全部"],
"description": "创建",
"parameters": [],
"responses": {
"200": {
"description": "Normal Response",
"content": {
"application/json": {
"schema": {
"required": ["projectId", "historyIdNow", "historyIdOld", "differContent"],
"type": "object",
"properties": {
"projectId": { "type": "number" },
"historyIdNow": { "type": "string" },
"historyIdOld": { "type": "string" },
"differContent": { "type": "string" }
},
"additionalProperties": false
}
}
}
},
"500": {
"description": "When Server takes a nap.",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"required": ["projectId", "historyIdNow", "historyIdOld", "differContent"],
"type": "object",
"properties": {
"projectId": { "type": "number" },
"historyIdNow": { "type": "string" },
"historyIdOld": { "type": "string" },
"differContent": { "type": "string" }
},
"additionalProperties": false
}
}
}
}
}
}
},
"components": {
"schemas": {
"Error": {
"type": "object",
"required": ["code", "err"],
"properties": { "code": { "type": "string" }, "err": { "type": "string" } }
}
}
}
}
用此json生成的代码

## Context(上下文)
- **pont Version**:
- lastest
- **Node Version**:
- v14.12.0
- **Platform(操作系统平台)**:
- mac
Contributor guide
Research direction
Start by reproducing the generated code with the supplied OpenAPI JSON, focusing on the POST response schema and its nested properties. Compare the generated response type with the schema's projectId, historyIdNow, historyIdOld, and differContent fields; the issue is done when these fields are represented with their declared types instead of a generic object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100