GenericAvroCodecs[T](schema.getOrElse(null)) should work