In my setup I am developing a Microprofile4 (Quarkus2) Java application. This comes with OpenApi3.
In this application, I want to define an example for a POST request parameter.
import org.eclipse.microprofile.openapi.annotations.media.Content;
import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody;
...
// IntegerInterval is a simple data class,
// having to int properties "start" and "end".
public List<IntegerInterval> returnIntervals(
@RequestBody(description = "Test description",
content = {@Content(example = "[{\"start\":0,\"end\":1}")})
List<IntegerInterval> intervals) {
return intervals;
}
While the "Test description" shows up in the OpenApi specification, the example value does not:
/merge-intervals
post:
requestBody:
description: Test description
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/IntegerInterval'
responses:
"200":
...