В настоящее время я работаю над документацией по API и решил реализовать ее с помощью ReDo c. Мой API построен с использованием Spring Boot .. и для документации я использую SWAGGER. Все хорошо, но я не могу аннотировать свой контроллер, чтобы показать часть «примеров ответов» справа в документации ReDo c. Я попытался добавить примеры в DTO, такие как:
@JsonIgnoreProperties(ignoreUnknown = true)
public class DocumentResponse {
@ApiModelProperty(notes = "XML reuslt", name = "xmlResult", example = "asdasd", dataType = "java.lang.String")
private String xmlResult;
Вот так выглядит мой контроллер:
@Api(tags = {"Document"})
@RestController
@CrossOrigin("")
@RequestMapping("/doc")
public class DocumentController {
@PostMapping(value = "/doc-create", consumes = {"application/json"})
@ApiOperation(value = "docCreate", notes = "Create Document", response = DocumentResponse.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Document success!", response = DocumentResponse.class),
@ApiResponse(code = 201, message = "Document created!", response = DocumentResponse.class),
@ApiResponse(code = 401, message = "Unauthorized!", response = DocumentResponse.class),
@ApiResponse(code = 403, message = "Forbidden!", response = DocumentResponse.class),
@ApiResponse(code = 404, message = "Not found!", response = DocumentResponse.class)})
public @ResponseBody DocumentResponse docCreate(@RequestBody DocumentRequest request) {
return null;
}
}