Java 如何在OpenApi Spring上添加不同的@Schema描述?

Java 如何在OpenApi Spring上添加不同的@Schema描述?,java,spring,swagger,openapi,Java,Spring,Swagger,Openapi,我在使用带有Spring的OpenApi定义API时遇到了一些问题。我正在使用此依赖项: <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>1.5.2</version> </dependency> 还有其他类似的反应 public

我在使用带有Spring的OpenApi定义API时遇到了一些问题。我正在使用此依赖项:

<dependency>
   <groupId>org.springdoc</groupId>
   <artifactId>springdoc-openapi-ui</artifactId>
   <version>1.5.2</version>
</dependency>
还有其他类似的反应

public class ModifyBalanceResponse {

    @Schema(description = "User identifier", example = "12")
    private Long id;
    @Schema(description = "Added balance", example = "{"type":"COINS","amount":500}")
    private Balance addedBalance;
    @Schema(description = "Updated balance", example = "{"type":"COINS","amount":1500}")
    private Balance updatedBalance;
...
因此,我有三个不同描述和示例的对象“Balance”,但当它生成文档时,使用该对象的所有响应和字段都采用相同的描述和示例

我已经看到,在生成的文件中,我使用“$ref”标记获得所有这些项,以平衡模式,并且仅使用定义的一个描述/示例生成,如下所示:

public class LoginResponse {

    @Schema(description = "User identifier", example = "12")
    private Long id;
    @Schema(description = "User balance", example = "{"type":"COINS","amount":1000}")
    private Balance balance;
...
addedBalance:
   $ref: '#components/schemas/Balance'
我已经尝试手动编辑该文件,并通过将其替换为

addedBalance:
   title: Balance
   description: Added balance
   example: '{"type":"COINS","amount":500}'
有没有办法用openapi提供的Spring注释来做类似的事情? 类似于忽略schema对象,并从字面上理解描述和示例。我不介意它是否未引用schema对象


感谢您的惠顾。

看起来像是springdoc中的一个问题。最好在这里问这个问题-