xiaoymin / knife4j

Knife4j is a set of Swagger2 and OpenAPI3 All-in-one enhancement solution
https://doc.xiaominfo.com
Apache License 2.0
4.07k stars 613 forks source link

返回值对象层级超过三层就不显示 @Schema(title)字段的值 #649

Open mrzhou1553 opened 1 year ago

mrzhou1553 commented 1 year ago

使用的版本号如下: jdk 17.0.8 springboot 3.0.9 knife4j-openapi3-jakarta-spring-boot-starter 4.3.0 springdoc-openai-starter-webmvc-ui 2.2.0 正常情况下定义的一个接口,具体的返回代码如下的时候,在doc.html页面上看到的接口从第三层返回对象就没有显示字段的title,请问本来的设计就是如此吗

@GetMapping("/test")
public Test test(){
    return new Test();
}
@Getter @Setter
public static class Test implements Serializable{
    @Schema(title = "test-test",description = "test-test-desc")
    private String test;
    private A a;
}
@Getter @Setter
public static class A implements Serializable{
    @Schema(title = "a-test",description = "a-test-desc")
    private String test;
    private B b;
}
@Getter @Setter
public static class B implements Serializable{
    @Schema(title = "b-test",description = "b-test-desc")
    private String test;
    private C c;
}
@Getter @Setter
public static class C implements Serializable{
    @Schema(title = "c-test",description = "c-test-desc")
    private String test;
}

screenshot-20230914-170904

mrzhou1553 commented 1 year ago

使用的版本号如下: jdk 17.0.8 springboot 3.0.9 knife4j-openapi3-jakarta-spring-boot-starter 4.3.0 springdoc-openai-starter-webmvc-ui 2.2.0