-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
Describe the feature
I was wondering if it would be useful to have Vert.x codegen support for generating HTTP client implementations from interfaces. For example, you could define something like this:
@VertxGen
@HttpClient
public interface PetStoreApi {
@Path(path = "/pets", method = HttpMethod.GET)
Future<List<Pet>> listAllPets(@QueryParam("page") int page, @QueryParam("limit") int limit);
@Path(path = "/pets/{id}", method = HttpMethod.GET)
Future<JsonObject> getPetData(@PathParam("id") String id);
}
The generated implementation would:
- Take an
HttpClient
as a constructor argument - Support primitive types,
JsonObject
, and data objects as request parameters - Support
JsonObject
and data objects as response types - Automatically handle path parameters, query parameters, and request/response serialization
This would provide a declarative way to define HTTP client interfaces similar to JAX-RS or Spring's @FeignClient
, reducing boilerplate code for REST API consumption in Vert.x applications.
Contribution
I'm willing to contribute this