使用Swagger Annotations时,无法为请求正文创建示例。
以下是RESTful资源/端点的注释内容:
@POST
@Path("/{carId}/conversation")
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "The AppJWT token", paramType = "header", required = true),
@ApiImplicitParam(name = "ON-BEHALF", value = "The ConsumerJWS token", paramType = "header", required = true),
@ApiImplicitParam(name = "v", value = "API version", defaultValue = "3", paramType = "query", required = true)
})
@ManagedAsync
@ApiOperation(value = "bla", notes = "")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "bla", response = CreateBlaResponse.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "The input was invalid, please check.", response = GenericError.class),
@ApiResponse(code = 401, message = "Unauthorized. Are the headers correct?"),
@ApiResponse(code = 429, message = "Too many requests, please try again later", response = CreateConversationResBody.class)
})
public void createConversationBatchPOST(@ApiParam(value = "Car ID the action should apply to", required = true) @PathParam("carId") String carId,
@ApiParam(name = "body", value = "The Json payload", required = true, examples = @Example(value = {@ExampleProperty(value = "{\"name\" : \"James\"}", mediaType = "application/json")}))
@RequestBody String body,
@Suspended final AsyncResponse asyncResponse) throws IOException {
//.... implementation
}
您是否了解方法签名
中注释的原因 @ApiParam(name = "body", value = "The Json payload",
required = true, examples = @Example(value = {@ExampleProperty(value = "{\"name\" : \"James\"}", mediaType = "application/json")}))
@RequestBody String body
没有导致Json的例子?