【发布时间】:2017-09-21 15:03:37
【问题描述】:
我在我的 api 文档中使用 Springfox swagger 2,并且我有以下控制器:
HelloController.java
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.wordnik.swagger.core.Api;
import com.wordnik.swagger.core.ApiParam;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
@RestController
@RequestMapping(value="/hello",method = RequestMethod.GET)
@Api(value="Hello wwwww", description="this controller will say hello")
public class HelloController {
//@ApiIgnore
@ApiOperation("Get all products of our database")
@RequestMapping(value = "/id", method = RequestMethod.GET)
private String hello(@ApiParam(name = "studentId",
value = "The Id of the Student to be viewed",
required = true)
@PathVariable ("student") Integer studentId) {
String name = "hello world";
return name;
}
}
所以问题是我的 swagger ui 中没有正确显示参数描述,知道为什么吗?
提前谢谢你。
【问题讨论】:
标签: java spring swagger swagger-ui swagger-2.0