here below is my avro schema which contains ext as a nested json
{
"name": "MyClass",
"type": "record",
"namespace": "com.acme.avro",
"fields": [
{
"name": "channel",
"type": "string"
},
{
"name": "eventType",
"type": "string"
},
{
"name": "language",
"type": "string"
},
{
"name": "currency",
"type": "string"
},
{
"name": "page",
"type": "string"
},
{
"name": "pos",
"type": "string"
},
{
"name": "browser_id",
"type": "string"
},
{
"name": "session_id",
"type": "string"
},
{
"name": "customer_id",
"type": "string"
},
{
"name": "created_at",
"type": "string"
},
{
"name": "ext",
"type": {
"name": "ext",
"type": "record",
"fields": [
{
"name": "product_name",
"type": "string"
}
]
}
},
{
"name": "purchase___reference_id",
"type": "string"
},
{
"name": "purchase___status",
"type": "string"
}
]
}
and i am trying to get it into my mapping.groovy file
mapping {
map eventParameters().value('channel') onto 'channel'
map eventParameters().value('eventType') onto 'eventType'
map sessionId() onto 'session_id'
map eventParameters().value('customerId') onto 'customer_id'
map eventParameters().value('currency') onto 'currency'
map eventParameters().value('page') onto 'page'
map eventParameters().value('pos') onto 'pos'
map eventParameters().value('browser_id') onto 'browser_id'
/* map timestamp() onto 'created_at' */
map eventParameters().value('ext.product_name') onto 'ext.product_name'
map eventParameters().value('reference_id') onto 'purchase___reference_id'
map eventParameters().value('status') onto 'purchase___status'
}
but im facing this error
Exception in thread "main" io.divolte.server.recordmapping.SchemaMappingException: Field ext.product_name does not exist in Avro schema; error in mapping eventParameters().value(ext.product_name) onto ext.product_name