mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Fix subResourcePath when using tags in java-jersey (#215)
This commit is contained in:
parent
1f1a47c57b
commit
79856abae9
@ -159,6 +159,19 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
@Override
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||
if (useTags) {
|
||||
String basePath = resourcePath;
|
||||
if (basePath.startsWith("/")) {
|
||||
basePath = basePath.substring(1);
|
||||
}
|
||||
int pos = basePath.indexOf("/");
|
||||
if (pos > 0) {
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (co.path.startsWith("/" + basePath)) {
|
||||
co.path = co.path.substring(("/" + basePath).length());
|
||||
}
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
|
||||
} else {
|
||||
String basePath = resourcePath;
|
||||
|
@ -35,7 +35,7 @@ public class AnotherFakeApi {
|
||||
private final AnotherFakeApiService delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi();
|
||||
|
||||
@PATCH
|
||||
|
||||
@Path("/dummy")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?" })
|
||||
|
@ -41,7 +41,7 @@ public class FakeApi {
|
||||
private final FakeApiService delegate = FakeApiServiceFactory.getFakeApi();
|
||||
|
||||
@POST
|
||||
|
||||
@Path("/outer/boolean")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", })
|
||||
@ -54,7 +54,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterBooleanSerialize(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/outer/composite")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", })
|
||||
@ -67,7 +67,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterCompositeSerialize(outerComposite,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/outer/number")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", })
|
||||
@ -80,7 +80,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterNumberSerialize(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/outer/string")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", })
|
||||
@ -93,7 +93,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterStringSerialize(body,securityContext);
|
||||
}
|
||||
@PUT
|
||||
|
||||
@Path("/body-with-query-params")
|
||||
@Consumes({ "application/json" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake", })
|
||||
@ -171,7 +171,7 @@ public class FakeApi {
|
||||
return delegate.testEnumParameters(enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,enumFormStringArray,enumFormString,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/inline-additionalProperties")
|
||||
@Consumes({ "application/json" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", })
|
||||
@ -184,7 +184,7 @@ public class FakeApi {
|
||||
return delegate.testInlineAdditionalProperties(requestBody,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/jsonFormData")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake" })
|
||||
|
@ -55,7 +55,7 @@ public class PetApi {
|
||||
return delegate.addPet(pet,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
|
||||
@Path("/{petId}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
|
||||
@ -74,7 +74,7 @@ public class PetApi {
|
||||
return delegate.deletePet(petId,apiKey,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/findByStatus")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@ -93,7 +93,7 @@ public class PetApi {
|
||||
return delegate.findPetsByStatus(status,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/findByTags")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@ -112,7 +112,7 @@ public class PetApi {
|
||||
return delegate.findPetsByTags(tags,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||
@ -149,7 +149,7 @@ public class PetApi {
|
||||
return delegate.updatePet(pet,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
|
||||
@ -169,7 +169,7 @@ public class PetApi {
|
||||
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
|
@ -36,7 +36,7 @@ public class StoreApi {
|
||||
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||
|
||||
@DELETE
|
||||
|
||||
@Path("/order/{order_id}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", })
|
||||
@ -50,7 +50,7 @@ public class StoreApi {
|
||||
return delegate.deleteOrder(orderId,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/inventory")
|
||||
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
||||
@ -64,7 +64,7 @@ public class StoreApi {
|
||||
return delegate.getInventory(securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/order/{order_id}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", })
|
||||
@ -79,7 +79,7 @@ public class StoreApi {
|
||||
return delegate.getOrderById(orderId,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/order")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store" })
|
||||
|
@ -49,7 +49,7 @@ public class UserApi {
|
||||
return delegate.createUser(user,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/createWithArray")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
|
||||
@ -62,7 +62,7 @@ public class UserApi {
|
||||
return delegate.createUsersWithArrayInput(user,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/createWithList")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
|
||||
@ -75,7 +75,7 @@ public class UserApi {
|
||||
return delegate.createUsersWithListInput(user,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
|
||||
@Path("/{username}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
|
||||
@ -89,7 +89,7 @@ public class UserApi {
|
||||
return delegate.deleteUser(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", })
|
||||
@ -104,7 +104,7 @@ public class UserApi {
|
||||
return delegate.getUserByName(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/login")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
|
||||
@ -119,7 +119,7 @@ public class UserApi {
|
||||
return delegate.loginUser(username,password,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/logout")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", })
|
||||
@ -131,7 +131,7 @@ public class UserApi {
|
||||
return delegate.logoutUser(securityContext);
|
||||
}
|
||||
@PUT
|
||||
|
||||
@Path("/{username}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" })
|
||||
|
@ -55,7 +55,7 @@ public class AnotherFakeApi {
|
||||
}
|
||||
|
||||
@PATCH
|
||||
|
||||
@Path("/dummy")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", })
|
||||
|
@ -61,7 +61,7 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
@Path("/outer/boolean")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", })
|
||||
@ -73,7 +73,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterBooleanSerialize(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/outer/composite")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", })
|
||||
@ -85,7 +85,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterCompositeSerialize(outerComposite,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/outer/number")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", })
|
||||
@ -97,7 +97,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterNumberSerialize(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/outer/string")
|
||||
|
||||
@Produces({ "*/*" })
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", })
|
||||
@ -109,7 +109,7 @@ public class FakeApi {
|
||||
return delegate.fakeOuterStringSerialize(body,securityContext);
|
||||
}
|
||||
@PUT
|
||||
|
||||
@Path("/body-with-query-params")
|
||||
@Consumes({ "application/json" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake", })
|
||||
@ -186,7 +186,7 @@ public class FakeApi {
|
||||
return delegate.testEnumParameters(enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,enumFormStringArray,enumFormString,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/inline-additionalProperties")
|
||||
@Consumes({ "application/json" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", })
|
||||
@ -198,7 +198,7 @@ public class FakeApi {
|
||||
return delegate.testInlineAdditionalProperties(requestBody,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/jsonFormData")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", })
|
||||
|
@ -74,7 +74,7 @@ public class PetApi {
|
||||
return delegate.addPet(pet,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
|
||||
@Path("/{petId}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
|
||||
@ -92,7 +92,7 @@ public class PetApi {
|
||||
return delegate.deletePet(petId,apiKey,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/findByStatus")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@ -111,7 +111,7 @@ public class PetApi {
|
||||
return delegate.findPetsByStatus(status,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/findByTags")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@ -130,7 +130,7 @@ public class PetApi {
|
||||
return delegate.findPetsByTags(tags,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||
@ -169,7 +169,7 @@ public class PetApi {
|
||||
return delegate.updatePet(pet,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
|
||||
@ -188,7 +188,7 @@ public class PetApi {
|
||||
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
|
@ -56,7 +56,7 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
@DELETE
|
||||
|
||||
@Path("/order/{order_id}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", })
|
||||
@ -70,7 +70,7 @@ public class StoreApi {
|
||||
return delegate.deleteOrder(orderId,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/inventory")
|
||||
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
||||
@ -83,7 +83,7 @@ public class StoreApi {
|
||||
return delegate.getInventory(securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/order/{order_id}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", })
|
||||
@ -99,7 +99,7 @@ public class StoreApi {
|
||||
return delegate.getOrderById(orderId,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/order")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
|
||||
|
@ -68,7 +68,7 @@ public class UserApi {
|
||||
return delegate.createUser(user,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/createWithArray")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
|
||||
@ -80,7 +80,7 @@ public class UserApi {
|
||||
return delegate.createUsersWithArrayInput(user,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Path("/createWithList")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
|
||||
@ -92,7 +92,7 @@ public class UserApi {
|
||||
return delegate.createUsersWithListInput(user,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
|
||||
@Path("/{username}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
|
||||
@ -106,7 +106,7 @@ public class UserApi {
|
||||
return delegate.deleteUser(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", })
|
||||
@ -122,7 +122,7 @@ public class UserApi {
|
||||
return delegate.getUserByName(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/login")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
|
||||
@ -137,7 +137,7 @@ public class UserApi {
|
||||
return delegate.loginUser(username,password,securityContext);
|
||||
}
|
||||
@GET
|
||||
|
||||
@Path("/logout")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", })
|
||||
@ -148,7 +148,7 @@ public class UserApi {
|
||||
return delegate.logoutUser(securityContext);
|
||||
}
|
||||
@PUT
|
||||
|
||||
@Path("/{username}")
|
||||
|
||||
|
||||
@io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
|
||||
|
Loading…
Reference in New Issue
Block a user