我有一个端点,它采用gps坐标数组来执行路由。第一点是开始,最后一点是结束。如何提供两个条目的示例?到目前为止@ApiParam
和@ApiImplicitParam
都没有工作。
// 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}]}")
它仍显示:
[
{
"lat": 50.000000,
"lon": 13.000000
}
]
我在课堂上添加的例子
@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;
修改
完整方法签名如下所示:
@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 {
...
}