2017-11-07 10 views
0

나는 자동 생성 된 REST 문서에 springfox-swagger2springfox-swagger-ui을 사용하고 있습니다.swagger-ui 생성 문서에서 @PostMapping 매개 변수를 표시하는 방법은 무엇입니까?

문제 : 모든 GET 요청은 잘 문서화되었습니다. 그러나 POST 요청의 경우 요청 본문 매개 변수 설명은 swagger UI에 표시되지 않습니다. 하지만 왜?

@RestController 
public class PersonController { 
    @GetMapping 
    public PersonRsp findPerson(PersonDTO p) { 
     //this works just fine an shows the @ApiParam fields in documentation 
    } 

    @PostMapping 
    public PersonRsp updatePerson(@RequestBody PersonDTO p) { 
     //service logic 
     return rsp; 
    } 
} 

class PersonDTO { 
    @ApiParam(required = true, value = "the persons family name") 
    private String lastname; 

    private String firstname; 

    @ApiParam(value = "date of birth in format YYYY-MM-DD") 
    private Date dob; 
} 

질문 : 내가 얻을 수있는 방법 @ApiParam 주석 힌트는 자신감-UI를 문서에 표시되는?

답변

0

간단한 대답은 : 하나 GET 요청 POST 요청에 대한 @ApiModelProperty("some description")@ApiParam을 사용하는 것 같다.