Skip to content
New issue

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

带有multipart文件请求参数的openapi.json导入进yapi后,请求参数显示不正常 #2754

Open
xyfAmo opened this issue Jun 4, 2024 · 1 comment

Comments

@xyfAmo
Copy link

xyfAmo commented Jun 4, 2024

版本号

1.10.2

什么问题

我使用这个openapi.json(这是参数关键的一个部分,请求参数)导入进yapi后显示不正常
{ "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "format": "binary", "type": "string" } } } } } }
期望显示:
Content-Type:multipart/form-data
Body中 file 类型为file
结果显示:
Content-Type: application/json
Body中 有一行参数,但是未显示任何名称和类型,只显示了一个非必须信息

如何复现此问题

~
可以使用以下java代码,集成swagger3和springdoc(版本任意)生成openapi.json文件后导入yapi
@Operation(summary = "上传文件") @PostMapping(value = "/test", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity<Object> test(@RequestPart(value = "file", required = false) MultipartFile file) { return new ResponseEntity<>(HttpStatus.OK); }

什么浏览器

~
chrome

什么系统(Linux, Windows, macOS)

macOS

@xyfAmo
Copy link
Author

xyfAmo commented Jun 4, 2024

由于一些特殊的原因,我不太方便直接截图直接展示结果,但是这确实是在我使用中发生的一个问题。不知道是自己用法出现问题还是其他。在上传之后,重新编辑该接口的其他信息,还会报错:{"errcode":40011,"errmsg":"服务器出错...","data":null}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant