mulesoft-labs / raml-jaxrs-codegen

Tools to enable RAML-first development in JAX-RS projects
Other
40 stars 44 forks source link

Path parameters not added for parent resource parameters #18

Closed olensmar closed 10 years ago

olensmar commented 10 years ago

The code generation currently doesn't add @PathParam arguments for path parameters in parent resources. I've changed Generator.addPathParameters to the following:

private void addPathParameters(final Action action, final JMethod method, final JDocComment javadoc)
        throws Exception
    {
        Resource resource = action.getResource();
        while( resource != null ) {
            for (final Entry<String, UriParameter> namedUriParameter : resource.getUriParameters().entrySet()) {
                addParameter(namedUriParameter.getKey(), namedUriParameter.getValue(), PathParam.class, method,
                        javadoc);
            }

            resource = resource.getParentResource();
        }
    }

which works fine. Do you want a pull-request for this?

usarid commented 10 years ago

Yes please - thank you Ole! On Jun 22, 2014 1:36 PM, "Ole Lensmar" notifications@github.com wrote:

The code generation currently doesn't add @PathParam arguments for path parameters in parent resources. I've changed Generator.addPathParameters to the following:

private void addPathParameters(final Action action, final JMethod method, final JDocComment javadoc) throws Exception { Resource resource = action.getResource(); while( resource != null ) { for (final Entry namedUriParameter : resource.getUriParameters().entrySet()) { addParameter(namedUriParameter.getKey(), namedUriParameter.getValue(), PathParam.class, method, javadoc); }

    resource = resource.getParentResource();
}

}

which works fine. Do you want a pull-request for this?

— Reply to this email directly or view it on GitHub https://github.com/mulesoft/raml-jaxrs-codegen/issues/18.

petrochenko-pavel-a commented 10 years ago

Should be fixed now