springboot+swagger传递参数的几种格式

    技术2022-07-13  73

    1.在请求头中传参数

    @ApiImplicitParam(value = "token", name = "token",dataType = "String",paramType="header")

    2.请求体中传递的参数是Java对象

    @ApiImplicitParam(name = "Car", value = "新增车辆",paramType = "body", required = true, dataTypeClass = Car.class)

    3.请求体中传递的参数是字符串

    @ApiImplicitParam(value = "车牌号", name = "carno",dataType = "String",paramType="query")

    4.传递多个参数

    @ApiImplicitParams(value = {@ApiImplicitParam(value = "第几页", name = "pageNo",dataType = "String",paramType="query"), @ApiImplicitParam(value = "token", name = "token",dataType = "String",paramType="header")})

     

    Processed: 0.010, SQL: 10