'@ApiModelProperty to @Schema

I'm trying to migrate springfox to springdoc using this code:

import io.swagger.annotations.ApiModelProperty;

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

to

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

@Schema(position = 20, required = false)

But I get not found for position and value. Do you know what is the proper way to replace them in springdoc?



Solution 1:[1]

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

position isn't available in Springdoc cause by default it preserves the order in which the fields are declared.

value was to describe the model property and is called description in the new world.

So the old code

import io.swagger.annotations.ApiModelProperty;

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

becomes

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

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1