spring-boot - 使用 JSONObject 作为 @RequestParam 的 Rest 服务的 Spring REST 文档
问题描述
我正在尝试为接受 JSONObject 作为@RequestParam 的休息服务编写 Spring 休息文档。前任:
URL - http://localhost:9090/report?request={cdomain:automation,date:20190920}
我还需要发布 cdomain 的描述和日期以供理解。我可以使用以下代码为 @PathVariable 生成其余文档:
URL - http://localhost:9090/report/11
this.mockMvc.perform(RestDocumentationRequestBuilders.get("/report/{id}",1))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andDo(document("fin-report/balance-sheet",
pathParameters(parameterWithName("id")
.description("Identifier of the person to be obtained.")),
responseFields()...
请让我知道如何以 @RequestParam 为 JSONObject 做文档,如下面的代码和 URL:
Code - @RequestMapping(method = RequestMethod.GET, produces = "application/json", path = "report)
public String getReport(@RequestParam(value="request") JSONObject jobjparam) {...}
URL - http://localhost:9090/report?request={cdomain:automation,date:20190920}
解决方案
推荐阅读
- python - 我收到“[Errno 2] No such file or directory”错误代码,即使我有直接/绝对路径....有什么建议吗?
- python - 如何计算数字数组的对数阶乘
- c++ - lambda 中的“变量阴影”警告(未捕获时)
- python - 将 Mobilenet 模型转换为 TFLite 会更改输入大小
- hyperledger - Hyperledger Composer 无法在 Ubuntu 20.04 上运行
- flutter - Flutter:具有持久性 BottomNavigationBar 的嵌套路由,但没有不必要地构建未选择的页面
- amazon-web-services - Terraform 获得 UnsupportedOperation:Microsoft SQL 尝试启动 amazon-linux 实例时
- javascript - 让 Bootstrap 4 固定导航栏向下滑动并在滚动时变为纯色
- c++ - 无法启动程序“MYPATH.exe”。该系统找不到指定的文件。当我尝试运行一个新的“hello world”控制台应用程序时
- spring-boot - 如何在某个条件下隐藏和显示部分表单?