Rest-api-doc
Rest-api-doc copied to clipboard
support rest params as methods arguments
Hi,
With grails there are two ways to access url parameters :
// First one, as a controller method argument
def index(String query) {
// ...
}
// Second one, with the params object
def index() {
String query = params.query
// ...
}
If we use the first solution, and use restapidoc to doc the params, we must do the following :
@RestApiParams(params=[
@RestApiParam(name="query", type="String", paramType = RestApiParamType.QUERY, description = "my query")
])
def index(String query) {
// ...
}
When getting params like this, restapidoc can directly have the type and the name. It would be great if we could do something like that :
def index( @RestApiParam(description="my query")
String query
) {
// ...
}
That's less boilerplate :)
I've done a small fix for that: The type will be automatically retrieve if method has parameters. @RestApiParam(name="query", type="String", paramType = RestApiParamType.QUERY,description = "my query") could be: @RestApiParam(name="query", paramType = RestApiParamType.QUERY,description = "my query")
Not perfect but a good start ;-) It will be available in 0.3.