@ApiModelProperty 到 @Schema

@ApiModelProperty to @Schema

我正在尝试使用以下代码将 springfox 迁移到 springdoc:

import io.swagger.annotations.ApiModelProperty;

@ApiModelProperty(position = 30, required = true, value = "Group value")

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(position = 20, required = false)

但是 positionvalue 找不到我。你知道在springdoc中替换它们的正确方法是什么吗?

Ensure that your fields are declared in the same order you want them to show up in swagger,

position 在 Springdoc 中不可用,因为默认情况下它会保留声明字段的顺序。

value是描述模型属性,在新世界被称为description

所以旧代码

import io.swagger.annotations.ApiModelProperty;

@ApiModelProperty(position = 30, required = true, value = "Group value")

变成

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description="Group Value", required = true)