Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Apache License 2.0
136
stars
84
forks
source link
If the response type of controller method is Object type, how can I tell raml the real response type I want? #269
Some controller like this:
@RequestMapping(value = "/v1/Users", method = RequestMethod.GET) @ResponseBody public Object Users(@ApiParam @ModelAttribute UserRequest request, HttpServletRequest servletRequest) { try { BookResponse data = BookService.build(request); afterResponse(request, servletRequest, data); return data; } catch (Exception e) { log.error("Book controller error, searchRequest: {}", JSON.toJSONString(request), e); return FailureResponse.getInternalErrorFailureResponse(); } }
you can see the return value type is “Object”。so I get the jsonschema like this:
schema: | { "type" : "any" }
but the schema I want is BookResponse type。 So how Can I use annotation to tell raml the response Type I want?
Some controller like this:
@RequestMapping(value = "/v1/Users", method = RequestMethod.GET) @ResponseBody public Object Users(@ApiParam @ModelAttribute UserRequest request, HttpServletRequest servletRequest) { try { BookResponse data = BookService.build(request); afterResponse(request, servletRequest, data); return data; } catch (Exception e) { log.error("Book controller error, searchRequest: {}", JSON.toJSONString(request), e); return FailureResponse.getInternalErrorFailureResponse(); } }
you can see the return value type is “Object”。so I get the jsonschema like this:schema: | { "type" : "any" }
but the schema I want is BookResponse type。 So how Can I use annotation to tell raml the response Type I want?