alibaba / pont

🌉数据服务层解决方案
MIT License
3.03k stars 254 forks source link

pont对swagger2生成的Form post表单参数的支持 #426

Closed foxmale007 closed 6 months ago

foxmale007 commented 6 months ago

采用form表单格式的参数,好像生成的前端文档Param定义为空的。 @ApiImplicitParams({ @ApiImplicitParam(name = "loginId", value = "管理员登录ID [maxlength=18]", required = true, dataTypeClass = String.class, paramType = "body"), @ApiImplicitParam(name = "userPsw", value = "用户密码 [maxlength=20]", required = true, paramType = "body"), @ApiImplicitParam(name = "validateCode", value = "页面验证码 [maxlength=4]", required = true, paramType = "body"), @ApiImplicitParam(name = "sid", value = "页面会话ID,建议由uuid请求生成或者页面随机算法生成uuid,需要与页面验证码servlet请求的一致", required = true, paramType = "body") })

public String doLogin(String loginId, String userPsw, String validateCode, String sid,@ApiIgnore RequestSite adminSite, HttpServletResponse response) { 。。。 }

生成的api文档没有Param部分,POST请求的话paramType 是form或body都没有生成,只有query方式可以。另外如果controller采用对象的方式也可以,不知道怎样才能正确支持form post格式

使用的是swagger2.9

我又写了个更简单的例子: @PostMapping("testPost") @ApiOperation(value = "后台管理员登录aaaa") public String testPost( @ApiParam("登录ID--》") String loginId, String userPsw, String validateCode, String sid,@ApiIgnore RequestSite adminSite, HttpServletResponse response){ return loginId + " " + userPsw; }

生成结果: /**

foxmale007 commented 6 months ago

找到问题了,pont的param这里只处理query类型的参数,原来是这个问题导致