0

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 {
    ...
}
tgr
  • 3,557
  • 4
  • 33
  • 63
  • Can you post the complete method signature and the model definition? – Helen May 18 '17 at 10:43
  • I have no model definition, because I generated it from the code, but I will provide the method signature. – tgr May 18 '17 at 11:01

0 Answers0