Ktorfit icon indicating copy to clipboard operation
Ktorfit copied to clipboard

Compile-time safe Ktorfit

Open esafirm opened this issue 1 year ago • 3 comments

Hi @Foso, great library! I was thinking of creating something like this but luckily found this first.

My concern with this is that

  1. There's a lack of a compile-time safe in the library,create() can throw a runtime error if the compiler plugin is not applied
  2. The needs to add an extra Gradle plugin to create the first condition

I assume you chose this design to mimic what Retrofit have, but maybe we can make this better by not doing so?

What I have in mind is to have a generation like Dagger and move the creation to the impl instead

interface  ExampleApi { ... }

// Instead of _ExampleApiImpl
val api = KtorfitExampleApi.create(ktorfit)

Let me know what you think.

Cheers!

esafirm avatar Mar 05 '23 03:03 esafirm