Description
Is your feature request related to a problem? Please describe.
The current ktor client (4.0.0-alpha.3) is close to what we need to target IOS and Android with a multiplatform client for our graphql server but not quite. However, a few simple fixes would make it possible to turn this into a multiplatform project allowing the generated code to be used from web, native, wasm, and jvm platforms.
Describe the solution you'd like
- Change the gradle build file for the ktor client to use the multiplatform plugin. Define e.g. jvm, ios-x86 and ios-arm, and js variants.
- Move configurations for ktor engine and json serialization into the plaftorm specific part of the source tree and keep the rest of the client code in the common part. From what I've seen there are no big obstacles to doing this as the generated code is cross platform and the ktor client is already cross platform.
- For the jvm builds, switch to using gson, which is the defacto serialization on Android instead of jackson.
Describe alternatives you've considered
-
We could build our own client and simply use the same class name and packages so the imports for the generated code work. This should not be hard. Short term this is probably what we will do.
-
Alternatively, the generated code could be changed to simply require the user to provide their own ktor httpclient instance. It would then be up to them to configure that properly and the generated code would have no com.expedia.* dependencies at all. Given how small this single class is, there is actually limited value in having a (wrong) default implementation there. At best its a convenience that users will probably want to override.