I have several endpoint classes that I have exposed to my Android client. The methods in these endpoints take entity type parameters. As you know that the endpoints have been exposed through the @Api annotation, I have not annotated the entity type parameters with @Api. The problem I am facing is these endpoints share a set of entity classes but when I generate the endpoint libs, these entity types are generated for each endpoint for the same classes. I wanted to have a common set of these classes for all the endpoints. Let me give you an example to elaborate the problem:
Lets say, I have an endpoint with the annotation:
@Api(
name = "learnerProfileVer1Api",
version = "v1",
resource = "learnerProfileVer1",
namespace = @ApiNamespace(
ownerDomain = "create.account.backend.learncity.com",
ownerName = "create.account.backend.learncity.com",
packagePath = ""
)
)
public class Endpoint1{
@ApiMethod(
name = "insert",
path = "learnerProfileVer1",
httpMethod = ApiMethod.HttpMethod.POST)
public LearnerProfileVer1 insert(LearnerProfileVer1 learnerProfileVer1) {....}
}
And another endpoint,
@Api(
name = "searchApi",
version = "v1",
title = "Search API",
namespace = @ApiNamespace(
ownerDomain = "learncity.com",
ownerName = "Learncity",
packagePath = ""
)
)
public class SearchTutorsEndpoint {
@ApiMethod(name = "searchTutors",
httpMethod = ApiMethod.HttpMethod.POST)
public CollectionResponse<TutorProfileVer1> searchTutors(SearchTutorsQuery searchTutorsQuery, @Nullable @Named("cursor") String cursor, @Nullable @Named("limit") Integer limit) {...}
}
You can see in the above 2 endpoints that I have LearnerProfileVer1
and SearchTutorsQuery
entity type parameters. These 2 classes use a few other classes that are common.
Now, when I generate the client-libs, I get 1 for learnerProfileVer1Api
which has a model
package in it where it has those classes and I get client-lib separately for SearchApi
that has a separate model
package with the SAME classes. This problem magnifies when I make link my client code to these client libs and I find 3 different versions of the same class.
Is there any solution to make these classes have a single set of client-libs generated?