Test Java/Kotlin object against avro schema

Viewed 108

I have a database which saves data after checking it against an avro schema. Sample avro schema

{
  "type": "record",
  "name": "test",
  "namespace": "com.test",
  "fields": [
    {
      "name": "id",
      "type": "string"
    },
    {
      "name": "name",
      "type": "string"
    }
  ]
}

Before making an actual call to save the data to the database, I am creating a Kotlin object. Sample data class

data class TestData(
 val id: String,
 val name: String
)

In the unit tests, is there a way to test the Kotlin object against the avro schema so that there won't be any issues while trying to save the data?

0 Answers
Related