I have an endpoint, which takes an array of gps coordinates to perform a routing. The first point is the start and the last one the finish. How can I provide an example with two entries? Neither @ApiParam
nor @ApiImplicitParam
worked so far.
// I tried this as parameter annotation
@ApiParam(example = "{\"points\":[{\"lat\":52.525252, \"lon\":13.131313}, {\"lat\":25.252525, \"lon\":31.313131}]}")
// and this as method annotation
@ApiImplicitParam(example = "{\"points\":[{\"lat\":52.525252, \"lon\":13.131313}, {\"lat\":25.252525, \"lon\":31.313131}]}")
It still displays:
[
{
"lat": 50.000000,
"lon": 13.000000
}
]
Those I added as example at the class
@ApiModelProperty(required = true, notes = "latitude [-90..90]", example = "50.000000")
private double lat;
@ApiModelProperty(required = true, notes = "longitude [-180..180]", example = "13.000000")
private double lon;
Edit
The full method signature looks like this:
@PostMapping(produces = "application/json")
// Swagger annotations
@ApiOperation(value = "Basic routing without sequence optimization")
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "Sorted array of waypoints in decimal notation."
),
@ApiResponse(
code = 500,
message = "a) Coordinates are not eligible for routing, because one or more are not on the streets.\n\n" +
"b) Less than two distinct coordinates were provided.",
response = String.class
)
})
public GeoPosition[] basicRouting(@RequestBody SearchDefinition def) throws RemoteException {
...
}