Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: No more kotlin-reflect for logical types #214

Merged
merged 10 commits into from
May 23, 2024
Prev Previous commit
Next Next commit
test: Support record with different field positions
Chuckame committed May 21, 2024
commit e8993e4f12d52e253f2086f10d4ddaaf484244df
Original file line number Diff line number Diff line change
@@ -136,9 +136,44 @@ internal class RecordEncodingTest : StringSpec({
AvroAssertions.assertThat(ObjectClass)
.isEncodedAs(record())
}
"support records with different field positions" {
val input =
Foo(
"string value",
2.2,
true,
S(setOf(1, 2, 3)),
ValueClass(ByteArray(3) { it.toByte() })
)

val differentWriterSchema =
SchemaBuilder.record("Foo").fields()
.name("b").type().doubleType().noDefault()
.name("a").type().stringType().noDefault()
.name("s").type(
SchemaBuilder.record("S").fields()
.name("t").type().array().items().intType().noDefault()
.endRecord()
).noDefault()
.name("c").type().booleanType().noDefault()
.name("vc").type().bytesType().noDefault()
.endRecord()

AvroAssertions.assertThat(input)
.isEncodedAs(
record(
2.2,
"string value",
record(setOf(1, 2, 3)),
true,
ByteArray(3) { it.toByte() }
),
writerSchema = differentWriterSchema
)
}
}) {
@Serializable
object ObjectClass {
private object ObjectClass {
val field1 = "ignored"
}