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

返回值泛型结构出现覆盖问题 #12

Closed
cuiyuanjie opened this issue Oct 30, 2021 · 2 comments
Closed

返回值泛型结构出现覆盖问题 #12

cuiyuanjie opened this issue Oct 30, 2021 · 2 comments

Comments

@cuiyuanjie
Copy link

我定义了一个R类,用于封装接口的返回对象,里面有error和data,data是泛型
在controller中接口返回值使用 R、R,ydoc可以正常解析,但从yapi上查看的接口返回结构中User或Teacher谁在最后(swagger的definitions部分),页面展示的结构就是哪个对象的
(将ydoc生产的swagger的json提取出来发现在 defintions结构中对R中data的定义只保留1个bean(要么是Teacher要么是User),而多个接口引用R的返回就导致展示返回值问题)

public R getUser(Long uId) {}
public R getTeacher(Long tId) {}

public R {
private T data;
.......
}

swagger json:
definitions部分:
"R":{"type": "object", "title": "R", "properties":{"data":{"description":"data", "$ref":"#/definitions/Teacher"}}}

接口定义部分:
paths:
/getUser
“responses”:
schema: $ref: "#/definitions/R"
/getTeacher
“responses”:
schema: $ref: "#/definitions/R"

@NoBugBoy
Copy link
Owner

嗯 确实只维护了一个单范型问题,这个我会解决一下

@NoBugBoy
Copy link
Owner

NoBugBoy commented Nov 1, 2021

1.1.0 解决了这个问题 包已经上传 预计11.2号可以更新依赖

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

2 participants