我正在尝试为rest服务编写Spring rest文档,该服务接受JSONObject作为@RequestParam。 例如:
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}