Hi! May be someone can recommend Kt best practice....
# server
a
Hi! May be someone can recommend Kt best practice. We have an integration sdk library. It is used on our backend. It has to support multiple platform versions. So when setting connection user provides credentials to their platform and it’s version. Depending on version some model may have or may have not some properties. I looked into annotations and reflection and it doesn’t looks as the most performant solution. Strategy + multiple model definitions looks crazy. Any thoughts?
a
Your models are (de)serialized to/from JSON ? If so, what lib do you use ? Kotlinx serialization, jackson, other ?
a
It is kotlinx @Alexis Manin
c
One option is to use opt-in requirements to mark which symbols are not available.
a
is not opt-in processed during compilation time? @CLOVIS
c
Yes, does that cause an issue?
a
@CLOVIS yeah… sdk lib is a dependency for multiuser app… every user may have different version configuration. I.e. it end-user models are identified via config during runtime.
c
So you have a SaaS thing which communicates with different versions of the same API, and you don't know which at compile-time?
If so, you're not getting any type safety, whatever you do
a
@CLOVIS Yes, it is SaaS like. I should be safe. I’m looking into generating option. Something like schema annotation + ksp + kotlinpoet.
c
If you don't know at compile-time which functions are safe to call, you cannot use code generation.
a
in case enumerate of endpoints different from version to version?