我试图理解如何在“swagger”中指定响应实际上是类"ViewObject.java"
的对象,其中包含类“Object”的对象,在下面的示例中包含{{1的实例}}。
在下面的代码中,当我将"App.java"
指定为@ApiOperation
时,它无法确定在ViewObject中“result”字段包含“App”的实例。
"response = ViewObject.class"
@GET
@Path("/app/{appCode}")
@Produces("application/json")
@ApiOperation(value = "Get App Configuration", response = ViewObject.class)
public @ResponseBody ViewObject getApp(@PathParam("appCode") String appCode) throws FreemoException,Exception {
App app = new App();
app.setAppCode(appCode);
ViewObject viewObject = new ViewObject();
App appLoadedFromDB = appService.getApp(app.getAppCode()); //Load App from DB
viewObject.setStatus(FreemoStatus.SUCCESS);
viewObject.setResult(appLoadedFromDB);
return viewObject;
}