-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Extension Proposal] easy-retrofit for Quarkus Extension #40585
Comments
/cc @aloubyansky (extension-proposal), @gastaldi (extension-proposal), @gsmet (extension-proposal), @maxandersen (extension-proposal) |
I know about https://square.github.io/retrofit/, but what is easy retrofit? is that some other thing? biggest issue I have with retrofit is that it seem to depend on okhttp which then drags in a lot of kotlin stdlib dependencies. that's unfortunate. but +1 for enabling use of retrofit from Quarkus - just be cautious about dependency chain issues this can trigger. |
The core of easy-retrofit is to implicitly provide retrofit instance injection to the DI framework and enhance the function with more annotations. for example , on official retrofit , public interface GitHubService {
@GET("users/{user}/repos")
Call<List<Repo>> listRepos(@Path("user") String user);
}
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.github.com/")
.build();
GitHubService service = retrofit.create(GitHubService.class);
Call<List<Repo>> repos = service.listRepos("octocat"); on easy retrofit, @RetrofitBuilder(baseUrl = "${app.hello.url}")
public interface HelloApi {
@GET("v1/hello/{message}")
Call<ResponseBody> hello(@Path("message") String message);
}
@Autowired
private HelloApi helloApi;
@GetMapping("/{message}")
public ResponseEntity<String> hello(@PathVariable String message) throws IOException {
final ResponseBody body = helloApi.hello(message).execute().body();
return ResponseEntity.ok(body.string());
} Actually, I have already completed the integration of the easy retrofit on quarks extension at my local. Do you need me to push the local git project to GitHub and review it? and last, @maxandersen thank you +1 for my project extension proposal , I want to know under what circumstances would a project be created for easy retrofit For more examples, you can take a look at easy-retrofit-readme, but the English readme is not a latest, and for Spring Framework demo at here. |
@maxandersen @gastaldi @aloubyansky @gsmet I would like to know when I can create a project for the easy retrofit extension in the Quarkiverse Hub |
@liuziyuan I can create a repository for you. Have you already created a protoype as a Quarkus extension (maybe in your personal org) so we can take a look or the plan is to start from zero? |
@gastaldi In my local , the core functions of the Quarkus easy retrofit project have been completed and I have pushed quarkus-easy-retrofit to my GitHub. This project is just a demo for you to see you can run integration-tests sub-module, http://localhost:8080/retrofit-client ,and observe the value returned by the retrofit interface |
@liuziyuan quarkiverse/quarkus-easy-retrofit is now provisioned. Welcome to Quarkiverse! See hub.quarkiverse.io/checklist/#after-the-repository-is-created for the next steps |
thanks for the info @liuziyuan - i took a look at the integration test sub module and wondered what these adapters are for: https://github.com/liuziyuan/quarkus-easy-retrofit/tree/main/integration-tests/src/main/java/io/quarkiverse/easy/retrofit/client/it/retrofit ? are those something users need to add? |
Essentially, The @RetrofitBuilder is a substitute for Retrofit @RetrofitBuilder(baseUrl = "${app.url}" ,
addConverterFactory = {JacksonConvertFactoryBuilder.class},
addCallAdapterFactory = {BodyCallAdapterFactoryBuilder.class, GuavaCallAdapterFactoryBuilder.class},
validateEagerly = false,
globalOverwriteRule = OverrideRule.LOCAL_FIRST)
//@RetrofitInterceptor(handler = TestInterceptor.class)
public interface BaseApi {
@GET("api/hello")
Call<ResponseBody> hello();
@GET("backend/v1/hello/abc")
HelloBean helloBean2();
} |
Description
Quickly using Retrofit 2 in the Quarkus project, the easy-retrofit provides an annotation based configuration to create Retrofit instances, and enhances general functionality through more annotations.
Currently, this project has completed its core functions within the Spring boot framework。
Retrofit is A type-safe HTTP client for Android and Java,Retrofit provides both synchronous and asynchronous HTTP requests。
easy retrofit
website on github easy-retrofit-spring-boot-staterRepository name
quarkus-easy-retrofit
Short description
easy-retrofit-client provides an annotation based configuration to create Retrofit instances, and enhances general functionality through more annotations.
Repository Homepage URL
https://quarkiverse.github.io/quarkiverse-docs/quarkus-easy-retrofit/dev/
Repository Topics
Team Members
Additional context
No response
The text was updated successfully, but these errors were encountered: