607 Star 4K Fork 875

GVP萧明 / knife4j

 / 详情

请问参数支持空字符串传递吗

Done
Opened this issue  
2020-08-11 09:11

如题,我编写的接口是这样的:

/**
 * 分页查询用户
 *
 * @param page  第几页
 * @param limit 查询条数
 * @param user  模糊查询参数
 * @return
 */
@GetMapping("/query-user-by-page")
@RequiresPermissions("sys:user:read")
@ApiOperation(value = "分页查询用户", notes = "分页查询用户(支持条件模糊查询)")
@ApiImplicitParams({
        @ApiImplicitParam(name = "page", value = "第几页", dataType = "int", paramType = "form", example = "1")
        , @ApiImplicitParam(name = "limit", value = "每页几条", dataType = "int", paramType = "form", example = "10")
        , @ApiImplicitParam(name = "userName", value = "用户登录名称(必填,可为空字符串)", dataType = "string", paramType = "form", allowEmptyValue = true)
        , @ApiImplicitParam(name = "userNickname", value = "用户昵称(必填,可为空字符串)", dataType = "string", paramType = "form", allowEmptyValue = true)
        , @ApiImplicitParam(name = "userPhone", value = "用户手机号码(必填,可为空字符串)", dataType = "string", paramType = "form", allowEmptyValue = true)
})
public Object queryUserByPage(Integer page, Integer limit, @ApiIgnore User user) {
    IPage<User> iPage = getUserPageBySearch(page, limit, user);
    iPage.setRecords(userService.wireUserAllInfos(iPage.getRecords(), true));
    return result.success(iPage.getRecords(), iPage.getTotal());
}

但在Knife4J的UI中显示是这样:
输入图片说明

CURL中传递的空字符串参数为null,请问有什么办法能传递空字符串?

Comments (2)

TeRny created任务
TeRny set related repository to 萧明/knife4j
展开全部操作日志

目前Curl里面这个显示的是null,算是Bug,下个版本会修复,但是真实调试的时候,不会传递null字符串

萧明 changed issue state from 待办的 to 进行中
萧明 added
 
enhancement
label
萧明 changed issue state from 进行中 to 已完成

Sign in to comment

状态
Assignees
Milestones
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
Branches
Planed to start   -   Planed to end
-
Top level
Priority
参与者(2)
118100 xiaoym 1578918321 4831300 terny 1617277698
Java
1
https://gitee.com/xiaoym/knife4j.git
git@gitee.com:xiaoym/knife4j.git
xiaoym
knife4j
knife4j

Search

101046 36f486cf 1899542 101055 4cb66026 1899542