0

I have a Spring Boot application where we moved from OpenAPI declaration in a swagger.yaml file to annotations on methods like:

@Operation(summary = "Function to query something by some parameter")
@ApiResponses(value = {
        @ApiResponse(responseCode = "200", description = "something successfully retrieved"),
        @ApiResponse(responseCode = "404", description = "No matching parameter")
})
@GetMapping(value = "/some_api_endpoint/{parameterValue}", produces = {"application/json"})
public ResponseEntity<?> getSomethingByParameterValue(
        @Parameter(description = "parameter value", schema = @Schema(type = "string", example = "some value")) @Valid @PathVariable(value = "parameterValue") String parameterValue) {
    return ResponseEntity.ok(service.getSomethingByParameterValue(parameterValue));

}

This works fine.

My question is related to trying out this endpoint using OpenAPI's web interface. When clicking on the "Try Out!" button, the fields for declared in the function are editable and can take parameters, but the example parameter needs to be manually removed.

Is there a way to automatically clear the parameters when the "Try Out" button is clicked?

gtludwig
  • 5,411
  • 10
  • 64
  • 90

0 Answers0