How to use specific value of enum in swagger schema using annotation

Viewed 77

Here are 3 simple Java classes:

@Getter
@Setter
public class Animal {
    protected String name;
    protected Integer age;

    public enum AnimalType{
        ANGRY,
        FUNNY

    }
}

@Getter
@Setter
public class Cat extends Animal{

    private AnimalType type=AnimalType.ANGRY;
}

@Setter
@Getter
public class Dog extends Animal{
    private AnimalType type=AnimalType.FUNNY;
}

What do I need to do so that swagger generates something like this?

type*  AnimalType  string
       value= FANNY
       Enum:
       >Array[2]

Is there any way to do it? I need to add ENUM for all classes and specific value of this enum for each class.

0 Answers
Related