我现在想用一个swagger给前端 或app端一个接口,然后,在接口里面做一个给前端展示的字段,不能用@RequestBody,因为他全部传输对象的所有字段才行。我这里不用全部字段,只是减少了一个字段的入参进来。
想问下,这样不用@requestBody的情况 下,怎么样给前端提示要什么样的字段呢?还是说,不需要给他们提供具体的字段样式了呢?
下面是后端接口的代码
@ApiOperation(value = "添加评论")
@PostMapping(value = "/add")
public Object addComment(HttpServletRequest request) {
JSONObject jsonObject = new JSONObject();
// userId.trim();@ApiParam("主键Id")String userId,
String userId = request.getParameter("userId"); //用户id
String type = request.getParameter("type"); //评论类型(0歌曲1歌单 2专辑?不是这个字节!!!看下面)
String songId = request.getParameter("songId"); //歌曲id