Thread
#multiplatform
    dave08

    dave08

    1 year ago
    How are platform specific annotations handled in common code? Say, in js I need to use kotlin serialization, whereas on the server, Micronaut uses Jackson...?
    Big Chungus

    Big Chungus

    1 year ago
    // commonMain
    expect annotation class Serializable
    
    // jvmMain
    actual typealias Serializable = JsonObject // or whatever jackson alternative is
    
    // jsMain
    actual typealias Serializable = kotlinx.serialization.Serializable
    dave08

    dave08

    1 year ago
    Yeah, but how would you handle the annotation's parameters? Like
    @Json("realfieldname")
    ...?
    Big Chungus

    Big Chungus

    1 year ago
    Same way
    typealias on one platform and delegate on the other