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

We look forward to adding support for @JsonView. #419

Closed
YanzMing opened this issue Feb 2, 2023 · 1 comment
Closed

We look forward to adding support for @JsonView. #419

YanzMing opened this issue Feb 2, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@YanzMing
Copy link

YanzMing commented Feb 2, 2023

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(需求来源)

swagger-api/swagger-core#2681

swagger-api/swagger-core#479

swagger-api/swagger-core#2662

@YanzMing YanzMing added the enhancement New feature or request label Feb 2, 2023
@shalousun shalousun added this to the 2.6.5 milestone Feb 3, 2023
@shalousun shalousun modified the milestones: 2.6.5, 2.6.6 Feb 28, 2023
@shalousun shalousun modified the milestones: 2.6.6, 2.6.8 Mar 29, 2023
@shalousun shalousun modified the milestones: 2.6.8, 2.7.0 May 27, 2023
@shalousun
Copy link
Collaborator

shalousun commented May 27, 2023

@YanzMing
Pull requests are welcome for collaborative development.
这个如果你能自己实现,欢迎提pr共建

@shalousun shalousun changed the title 期望添加对 @JsonView 的支持 We look forward to adding support for @JsonView. Mar 7, 2024
@linwumingshi linwumingshi modified the milestones: 2.7.0, 3.0.7 Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants