Reputation: 73
I have the following controller method
@ApiOperation(value = "Send a signin request with a provider")
@GetMapping("/{provider}/signin")
public void signIn(@PathVariable String provider, HttpServletResponse response) {
service.signIn(provider, response);
}
And what I want to know is if there is way to specify the possible values, that can be passed in the provider path variable. On the Swagger docs I see something about enums, but I don't know how to use this on my Spring Boot app. And on the SpringFox docs I couldn't find the word enum. Thanks in advance
Upvotes: 3
Views: 1960
Reputation: 167
Here is sample code for generating available options. This example shows how to multi-select available options. Just use String instead of List for single select
@GetMapping(value = "/request/......", produces = {"application/xml"})
public ResponseEntity<?> createMandate(@NotNull @ApiParam(value = "Test
Case", required = true, allowableValues = "happy-path, dirty-path, wrong-
path") @RequestParam(value = "TestCase", required = true) List<String>
testCases,
@NotNull
@ApiParam(value = "Another Text Field input") @RequestParam(value =
"CustomerMSISDN", required = true) String customerMsisdn) {
return ??
}
Upvotes: 5