fix JaxRS code gen to only generated @PATH annotation on a given resource function when that function is a "sub resource" (e.g. @PATH("/{id}") or @PATH("/{id}/operation")

This commit is contained in:
russellb337
2015-01-02 13:52:36 -08:00
parent 21396d0797
commit 9aa9f4e842
3 changed files with 3 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ import com.wordnik.swagger.models.*;
import java.util.*;
public class CodegenOperation {
public Boolean hasParams, returnTypeIsPrimitive, returnSimpleType;
public Boolean hasParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation;
public String path, operationId, returnType, httpMethod, returnBaseType,
returnContainer, summary, notes, baseName, defaultResponse;

View File

@@ -80,6 +80,7 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
else {
if(co.path.startsWith("/" + basePath))
co.path = co.path.substring(("/" + basePath).length());
co.subresourceOperation = !co.path.isEmpty();
}
List<CodegenOperation> opList = operations.get(basePath);
if(opList == null) {

View File

@@ -20,7 +20,7 @@ import javax.ws.rs.*;
public class {{classname}} {
{{#operation}}
@{{httpMethod}}
@Path("{{path}}")
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}})
@ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},