Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: @Parameter allowed values (enum) #146

Closed
membersound opened this issue Nov 7, 2019 · 1 comment
Closed

Add: @Parameter allowed values (enum) #146

membersound opened this issue Nov 7, 2019 · 1 comment

Comments

@membersound
Copy link

How can I achieve the following generated mapping?

"parameters":[
   {
      "name":"myformat",
      "in":"query",
      "required":true,
      "type":"string",
      "allowEmptyValue":false,
      "enum":[
         "csv",
         "json",
         "xml"
      ]
   }
]
@Parameter(name = "myformat", required = true) String myformat

Maybe you could add a property allowableValues = ["csv", "json", "xml"] to @Parameter?

@springdoc
Copy link
Collaborator

Hi,

Here is a sample code, how to achieve Enums.

   @GetMapping("/example")
   public Object example(@Parameter(name ="json", schema = @Schema(description = "var 1",type = "string", allowableValues = {"1", "2"}))
   String json) {
       return null;
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant