-
Notifications
You must be signed in to change notification settings - Fork 280
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
Support for polymorphic return display. #614
Comments
Smart-Doc scans static code and does not have the ability to dynamically obtain field values. |
自动回复:你的邮件我已经收到,如果需要回复的我会尽快回复的。感谢你的谅解····
|
Swagger should also not be able to support it. |
Swagger has the logic of oneOf, and the subclasses themselves are static. |
Jackson also has the @JsonSubTypes annotation that can be declared on a parent class. The logic is almost the same; it checks if the current class has the @JsonSubTypes annotation, reads the list of @JsonSubTypes.Type from it, and converts the list into a structure similar to oneOf? |
We'll take a look later, but it might be difficult to support this in the short term. The implementation should not be difficult, but the existing data structure needs optimization to support this feature. |
Is it possible to define multiple return values in a Controller? In many business cases, such as when an ID doesn't exist in the database, the server should respond with HTTP Status 200 and an error code like SuccessHTTP Status 200 {
"code": 0,
"data": {
"type": "electronics",
"id": "65669ce3c684f6144ce5cf5f",
"name": "iPhone 15 Pro Max"
},
"msg": "success",
"msg_cn": ""
} FailHTTP Status 200 {
"msg": "Record Not Found",
"code": 10001,
"msg_cn": "未找到记录"
} |
自动回复:你的邮件我已经收到,如果需要回复的我会尽快回复的。感谢你的谅解····
|
A parent class may have multiple subclasses as a return type, and based on the value of a field, different subclasses will be returned.
一个父类返回可能会有多种子类,根据一个字段值,对应不同的子类
The text was updated successfully, but these errors were encountered: