I have this WebService API mustache file from swagger:
{{>generatedAnnotation}}
{{#operations}}
public class {{classname}}ServiceImpl extends {{classname}}Service {
{{#operation}}
@Override
public Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}}{{#hasMore}},{{/hasMore}}{{/allParams}})
throws NotFoundException {
foo(...)
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "foo")).build();
}
{{/operation}}
what is generated is a Restful API:
@Override
public Response findPets(List<String> tags,Integer limit) throws NotFoundException {
foo(...)
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "foo")).build();
}
The ">serviceQueryParams" etc. are seperate mustache files and look like:
{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
What i want is to call a function (foo) that takes the same parameters as in the generated API methods:
public Response findPets(List<String> tags,Integer limit) throws NotFoundException {
foo(tags, limit);
...
another example:
@Override
public Response addPet(NewPet pet) throws NotFoundException {
foo(pet);
....
I have the foo function already defined in java, but i need to edit the mustache file so that the code will be generated correctly.
Take a look at the api.mustache file as an example, you can simply update your api.mustache
file like such:
foo({{#allParams}}{{#isFile}}fileDetail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}{{#hasMore}},{{/hasMore}}{{/allParams}});