Closed Chuckame closed 2 months ago
Inside tests, there is some Pair tests disabled. They are checking that:
@Serializable data class StringDoubleTest(val p: Pair<String, Double>)
should generate a schema of :
{ "type": "record", "name": "StringDoubleTest", "namespace": "com.github.avrokotlin.avro4k.schema.PairSchemaTest", "fields": [ { "name": "p", "type": [ "string", "double" ] } ] }
But a pair is not an union like Either in scala (surely the misunderstanding during the conversion of avro4s to avro4k).
Either
We should fix it to just generate record with string and double fields (the default native descriptor):
{ "type": "record", "name": "StringDoubleTest", "namespace": "com.github.avrokotlin.avro4k.schema.PairSchemaTest", "fields": [ { "name": "p", "type": { "type": "record", "name": "Pair", "namespace": "kotlin", "fields": [ { "name": "first", "type": "string" }, { "name": "second", "type": "double" } ] } } ] }
And if the user wants to handle it in another way, then just serialize it using a standard contextual serializer.
Done in #174
Inside tests, there is some Pair tests disabled. They are checking that:
should generate a schema of :
But a pair is not an union like
Either
in scala (surely the misunderstanding during the conversion of avro4s to avro4k).We should fix it to just generate record with string and double fields (the default native descriptor):
And if the user wants to handle it in another way, then just serialize it using a standard contextual serializer.