我正在使用swagger设置api端点,并且需要body类与swagger模型类相同,但是这样做会使端点无法正常工作。
@Operation(description = "body example is in model tab",
responses = {@ApiResponse(responseCode = "200", description =
"description") }, summary = "summary", tags = "Courier APIs")
@POST
@Secured
@Path("test")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_JSON)
public Response foo(
@RequestBody(required = true, content =
@Content(schema = @Schema(implementation = SwaggerMessages.class),
mediaType = "application/xml")) SwaggerMessages body) {
//do work with body
}
我希望能够将类的某些编码(即json的xml)作为resquest主体发送,但是当我尝试向该端点发送请求时,它总是返回错误500,甚至没有进入方法>