-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
area/openapiarea/smallryearea/swagger-uienv/windowsImpacts Windows machinesImpacts Windows machineskind/bugSomething isn't workingSomething isn't working
Milestone
Description
Describe the bug
Specifying a default value for an enum parameter on a REST API has no effect on the generated openapi.yaml or a pre-selection of the respective value in the swagger-ui.
@Path("/hello-resteasy")
public class GreetingResource {
public enum MyEnum {
CAT,
DOG,
BAR,
FOO
}
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello(
@Parameter(required = true)
@QueryParam(value = "myEnum")
@DefaultValue("DOG") // -> I want MyEnum.DOG to be the default value
final MyEnum myEnum
) {
return "myEnum = " + myEnum;
}
}Expected behavior
Openapi.yaml should specify "DOG" as parameter default and the "DOG" entry should also be pre-selected in swagger-ui.
Actual behavior
The first entry of the enum values sorted alphabetically is pre-selected.
To Reproduce
Steps to reproduce the behavior:
- Extract code-with-quarkus.zip and run
- Go to http://localhost:8080/q/swagger-ui/#/default/get_hello_resteasy
Screenshots
Here is a comparison of how the Openapi.yaml is currently generated (left) and how it could be generated to solve this issue (right).
After this change, swagger-ui would render:
Environment (please complete the following information):
- Output of
uname -aorver: Microsoft Windows [Version 10.0.18363.1198] - Output of
java -version: openjdk version "11.0.9.1" 2020-11-04 LTS - GraalVM version (if different from Java):
- Quarkus version or git rev: 1.11.1.Final
- Build tool (ie. output of
mvnw --versionorgradlew --version): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Metadata
Metadata
Assignees
Labels
area/openapiarea/smallryearea/swagger-uienv/windowsImpacts Windows machinesImpacts Windows machineskind/bugSomething isn't workingSomething isn't working


