Merge pull request #364 from Helmsdown/jaxrs-path-annotation-fix

JAXRS Codegen should omit @PATH variable when it is not necessary
This commit is contained in:
Tony Tam
2015-01-11 22:55:36 -08:00
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}},