forked from loafle/openapi-generator-original
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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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}},
|
||||
|
||||
Reference in New Issue
Block a user