我关注了这篇文章:https://stackoverflow.com/a/30407999/2458858,并使用自定义queryparam成功创建了jersey rest api
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Path("/test")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(notes = "test api", value = "Get", nickname = "gettest", tags = {"Salus/Identity" })
public Response identity2(@QueryParam("user") Tempuser user1) {
return Response.ok().build();
}
我还在此自定义类上使用了@ApiModel
:
@XmlRootElement(name="TempUser")
@ApiModel(value="DifferentModel", description="Sample model for the documentation")
public class Tempuser {
private String name;
public Tempuser(String name) {
this.name = name;
}
@XmlElement(name = "name")
@ApiModelProperty(required = true)
public String getName() {
return name;
}
public void setType(String name) {
this.name = name;
}
public static Tempuser valueOf(String name) {
return new Tempuser(name);
}
}
但是,当我加载swagger文档时,它仍将TempUser
显示为String类型:
Swagger不支持自定义数据类型?