YMFE / yapi

YApi 是一个可本地部署的、打通前后端及QA的、可视化的接口管理平台
http://yapi.smart-xwork.cn/
Apache License 2.0
27.32k stars 4.78k forks source link

返回数据总是显示OK(BUG) #2326

Closed Yi-Xing closed 2 years ago

Yi-Xing commented 3 years ago

版本号

  Swagger 版本

            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-boot-starter</artifactId>
                <version>3.0.0</version>
            </dependency>

  Yapi版本,我使用你们提供的体验地址,也会出现问题。

什么问题

  使用 Swagger 进行接口导入,请求参数可以导入进,但返回数据导入不进(总是显示OK)。 image

如何复现此问题

  使用 Swagger 生成 api-docs 然后导入 Yapi 中。

什么浏览器

  谷歌

什么系统

  Windows

ariesly15 commented 2 years ago

请提供测试数据 @Yi-Xing

Yi-Xing commented 2 years ago

{"openapi":"3.0.3","info":{"title":"aaaa","description":"aaaaa。","contact":{"name":"David","url":"https://github.com/aaaa","email":"1156490000@qq.com"},"version":"0.0.1"},"servers":[{"url":"http://zx.wm.com:80","description":"Inferred Url"}],"tags":[{"name":"应用申请","description":"App Apply Controller"},{"name":"应用订购","description":"App Ordering Controller"}],"paths":{"/app/queryAppInfo":{"post":{"tags":["应用订购"],"summary":"查询应用信息","operationId":"queryAppInfoUsingPOST","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppInfoQuery"}}}},"responses":{"200":{"description":"OK","content":{"/":{"schema":{"$ref":"#/components/schemas/返回数据«AppInfoVo»"}}}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}}},"components":{"schemas":{"AppInfoQuery":{"title":"AppInfoQuery","required":["appCode","venderId"],"type":"object","properties":{"appCode":{"type":"string","description":"应用编码"},"venderId":{"type":"integer","description":"店铺Id","format":"int64"}}},"返回数据«AppInfoVo»":{"title":"返回数据«AppInfoVo»","type":"object","properties":{"code":{"type":"integer","format":"int32"},"data":{"$ref":"#/components/schemas/AppInfoVo"},"extData":{"type":"string"},"message":{"type":"string"},"success":{"type":"boolean"},"totalCount":{"type":"integer","format":"int64"}}}}}}

ariesly15 commented 2 years ago

@Yi-Xing 你这数据不标准吧 https://editor.swagger.io/ 去这个网站验证下吧

ariesly15 commented 2 years ago

把 responses 中 200下的 content 下的 / 改为 application/json 展示正常 @Yi-Xing

Yi-Xing commented 2 years ago

已解决,谢谢。我这个数据就是Swagger直接导出的,你的Swagger用的是什么版本的。

ariesly15 commented 2 years ago

"swagger-client": "3.5.1"