package com.sksamuel
case class Foo(userName: String, emailAddress: String)
implicit val snake: FieldMapper = SnakeCase
val schema = AvroSchema[Foo]
println(schema) // no snake_case fields name
This example doesn't return the expected result. Custom field mapper and given instead of implicit val doesn't work, too. I've found a small workaround for issues with the schema generation:SchemaFor[T].schema. But the main issue thatEncoder/Decoder` take context without considering an implicit FieldMapper.
as result when I try to decode GenericRecord(or raw arvo) with snake cased schema, I get error in SchemaFieldDecoder, stack trace below.
cause=Exception in thread "zio-fiber-" java.lang.NullPointerException: null
at com.sksamuel.avro4s.decoders.SchemaFieldDecoder.<init>(records.scala:64)
at com.sksamuel.avro4s.decoders.RecordDecoder.$anonfun$1(records.scala:19)
at scala.collection.ArrayOps$.map$extension(ArrayOps.scala:932)
at scala.IArray$package$IArray$.map(IArray.scala:179)
at com.sksamuel.avro4s.decoders.RecordDecoder.decode(records.scala:20)
at com.sksamuel.avro4s.FromRecord$$anon$1.from(FromRecord.scala:15)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This example doesn't return the expected result. Custom field mapper and
given
instead ofimplicit val doesn't work, too. I've found a small workaround for issues with the schema generation:
SchemaFor[T].schema. But the main issue that
Encoder/
Decoder` take context without considering an implicit FieldMapper. as result when I try to decode GenericRecord(or raw arvo) with snake cased schema, I get error in SchemaFieldDecoder, stack trace below.