swagger2前台页面测试接口,参数类型为path时报错问题required field is not provided解决方法

解决方法如下:如果参数作为路径,则不用再使用注解来声明该参数,否则在swagger2-ui页面中进行测试,则会出现required field is not provided错误,一直测试不通

//不能再写这个参数的说明信息了,否则swagger接口调试会报错 required field is not provided
    //@ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Integer", paramType = "path")
    @GetMapping("/{id}/getUser")
    public User getUserById(@PathVariable("id") int id){
        return userService.getById(id);
    }

你可能感兴趣的:(swagger)