Add support for schema evolution
See original GitHub issueDoes avro4k support reading the default value and putting it into the Avro schema? Found an issue doing an experiment with schema evolution where newer version couldn’t read older version Version “0.1.0”
@Serializable
data class WebhookData(val firstName: String, val lastName: String, val age: Int? = null)
{
"type" : "record",
"name" : "WebhookData",
"namespace" : "com.shoprunner.data.webhook.model",
"fields" : [ {
"name" : "firstName",
"type" : "string"
}, {
"name" : "lastName",
"type" : "string"
}, {
"name" : "age",
"type" : [ "null", "int" ]
} ]
}
Version “0.2.0”
@Serializable
data class WebhookData(val firstName: String, val lastName: String, val age: Int? = null, val favoriteColor: String? = null)
{
"type" : "record",
"name" : "WebhookData",
"namespace" : "com.shoprunner.data.webhook.model",
"fields" : [ {
"name" : "firstName",
"type" : "string"
}, {
"name" : "lastName",
"type" : "string"
}, {
"name" : "age",
"type" : [ "null", "int" ]
}, {
"name" : "favoriteColor",
"type" : [ "null", "string" ]
} ]
}
But since default values aren’t set, it can’t read the older data.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Schema Evolution and Compatibility - Confluent Documentation
Schemas evolve in a fully compatible way: old data can be read with the new schema, and new data can also be read...
Read more >10. Schema Evolution Support - Spring
Spring Cloud Stream provides support for schema evolution so that the data can be evolved over time and still work with older or...
Read more >Schema Evolution - Apache Hudi
Schema evolution is a very important aspect of data management. Hudi supports common schema evolution scenarios, such as adding a nullable field or...
Read more >Practical Schema Evolution with Avro | by Elliot West - Medium
Beyond the specification — applying schema evolution to real-world situations ... Asking schema compatibility questions ahead of time can help us avoid ...
Read more >Adding support for schema evolution | Oracle Coherence 3.5
Adding support for schema evolution ... Now that you know everything you need to know about serialization and POF, let's discuss the closely...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s one I’m messing around with:
It passes. If you take away the null default value, you get
READER_FIELD_MISSING_DEFAULT_VALUE
Closing this issue as it seems to be fixed