easy-yapi
easy-yapi copied to clipboard
[Feature] We look forward to adding support for @JsonView.
Adding support for @JSONVIEW(期望添加对 @JSONVIEW 的支持)
Purpose of the requirement(需求目的)
Based on annotations, different documentation information can be generated.
(JsonView is a very convenient and powerful method that allows the use of models without duplicating resources. It determines the response field information by grouping with different views, eliminating the need to create redundant VOs)
As in the following example services A and B: 可以根据注解来生成不同的文档信息
(JsonView是一种非常方便且功能强大的方法,可以不复制资源使用的模型, 通过不同的视图分组来确定响应的字段信息,不需要创建冗余的 VO)
如以下示例服务A与服务B:
@GetMapping("/serviceA")
@JsonView(Entity.ViewA.class)
public Entity methodA() {...}
@GetMapping("/serviceB")
@JsonView(Entity.ViewB.class)
public Entity methodB() {...}
public Entity (){
@JsonView(ViewA.class)
private String A;
@JsonView(ViewB.class)
private String B;
public interface ViewA{}
public interface ViewB{}
}
The response contents of the above two services are as follows(以上两个服务的响应内容分别为):
RES_A:{
A:""
}
RES_B:{
B:""
}
In the current version, the documentation generated for the above two services will describe all fields, for example(当前版本对于以上两个服务所生成的文档会将所有字段进行描述,如):
RES_A:{
A:"",
B:""
}
RES_B:{
A:"",
B:""
}
What is expected for the documentation generated from the above two services is(对于以上两个服务生成的文档所期望的是):
RES_A:{
A:""
}
RES_B:{
B:""
}
When generating documentation, it is hoped to support @JSONVIEW. 在生成文档时希望支持@JSONVIEW,
Source of requirements(需求来源)
https://github.com/swagger-api/swagger-core/pull/2681
https://github.com/swagger-api/swagger-core/issues/479
https://github.com/swagger-api/swagger-core/pull/2662