Arnab
05/08/2025, 8:32 AMdave
05/08/2025, 9:25 AMArnab
05/08/2025, 9:30 AMObject UserRepo {
fun getSomeUser(userId: String): User ...
}
val getUser : HttpHandler = ...
Now in my SDK, I just want to expose a function like:
mySDK().getUser(userId = "xxx") // this would just call the UserRepo.getSomeUser() function
And this is the functionality I want to expose. I don't need 1:1 parity necessarily.
Of course, exposing a OpenApi spec and asking our clients to codegen a client is viable as well 🙂James Richardson
05/08/2025, 9:35 AMArnab
05/08/2025, 9:44 AMDo people actually want an SDK?Yup. Not everyone, but some people do 🙂 and we want to support them as well as those that prefer the openapi spec as a starting point.
For example sdk that I get often have poor types, use a mixed bag of logging libraries, have poor error handling etc etc, much easier for me to write to a network api/spec.I want to handwrite this SDK to combat exactly that. Using errorhandling in SDK, we have an opportunity to have an opinionated way to support usecases.
James Richardson
05/08/2025, 12:13 PMJames Richardson
05/08/2025, 12:14 PMAndrew O'Hara
05/08/2025, 1:58 PMhttp4k-api-openapi
, you can share the `ContractRoute`s between the server and client. I sometimes do this for the fakes of my external clients. Only wrinkle is that if you're adding a Security
to the ContractRoute
, you need to be able to override the Security
to null for your client.
You can also share your DTOs, their lenses, and your samples used for the ContractRoute
James Richardson
05/08/2025, 5:39 PMAndrew O'Hara
05/08/2025, 6:46 PM