Swagger给接口入参加注释

请求行上的参数:使用注解:@ApiImplicitParams

    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "userCode", value = "用户编码", dataType = "String", required = true),
            @ApiImplicitParam(name = "age", value = "年龄", dataType = "String", required = true)
    })
    @PostMapping("/demo")
    public ResponseResult<Boolean> demo(@RequestParam("userCode") String userCode, @RequestParam("age") String age) {
        return new ResponseResult<Boolean>().success();
    }

请求体中的参数:使用注解:@ApiModelProperty

    @ApiModelProperty(name = "nameCode", value = "用户编码")
    private String nameCode;

    @ApiModelProperty(name = "age", value = "年龄")
    private String age;

你可能感兴趣的:(java,开发语言)