2
스프링 부트 1.4 및 Swagger and Swagger UI를 사용하는 데 문제가 있습니다. @RequestBody 매개 변수를 사용할 때 데이터 유형 문자열로 표시됩니다. 이것은 정확하지 않습니다.봄 부팅 + Swagger + Swagger UI 및 @RequestBody 데이터 유형 문자열이 있습니다.
@ApiOperation(value = "simple message resource")
@ApiImplicitParams({
@ApiImplicitParam(name = "message", value = "Message to send", required = true, dataType = "com.larmic.springboot.swagger.rest.dto.MessageDto", paramType = "body")
})
@RequestMapping(value = "/api/message", method = RequestMethod.POST,
consumes = {"application/json", "application/xml"})
public void sendMessage(@RequestBody MessageDto message) {
System.out.println("ping");
}
및
@XmlRootElement(name = "MessageDto")
@XmlAccessorType(XmlAccessType.FIELD)
@ApiModel(value = "MessageDto", description = "TODO")
public class MessageDto {
@ApiModelProperty(value = "Message content text", required = true, example = "some demo message")
private String content;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
내가 MessageDto의 전체 이름을 사용하거나 @ApiModel의 올바른 값을 설정하지만 아무것도 작동하는 것 같다없는 수정을 많이 발견했습니다
.나는
https://github.com/larmic/SpringBootAndSwaggerUI 어쩌면 누군가가 도움이 될 수 있습니다 여기에 전체 예제를 만들었습니다.
감사합니다 많이! 이것은 효과가있다! https://github.com/larmic/SpringBootAndSwaggerUI에 수정 사항을 적용했습니다. –