'Swagger V3 Annotation Enum

I am trying to get swagger annotations to generate for the code below. Below is my API endpoint, I removed the response etc to keep this very basic. It takes in a body request of UMQueryRequest.

 public void query( @RequestBody(description = "Unified Model Query Request", required = true,
                          content = @Content(
                                  schema = @Schema(implementation = UMQueryRequest.class))) UMQueryRequest request) {
       //Implementation Here:

}

UMQueryRequest has an enum property ModelPurpose inside of it that swagger will not generate.

@Schema(description = "UMQueryRequest")
public class UMQueryRequest {

   @JsonProperty
   private ModelPurpose modelPurpose;
}

ModelPurpose.class

@Schema(enumAsRef = true, implementation = ModelPurpose.class)
public enum ModelPurpose {
   Default {
      //Implementation Here
   }, Alternative {
      //Implementation Here
   }
}

Any Ideas on how to make swagger generate this code? I have tried a lot of stack overflow but nothing seems to work. Thanks.



Sources

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

Source: Stack Overflow

Solution Source