Avro - Defining nested types

February 18, 2016

Message:

{"source": "<source>", "action": "<action>", "identifier": "<identifier>", "data": { "productId": "<productid>", "keywords": "<keywords>" }, "start": <timestamp>}

Avro serialization schema:

{"namespace": "event.serialization.model.<package\_name>", "type": "record", "name": "<outer\_class\_name>", "fields": \[ {"name": "source", "type": \["string", "null"\]}, {"name": "action", "type": \["string", "null"\]}, {"name": "identifier", "type": \["string", "null"\]}, {"name": "data", "type": { "type": "record", "name": "<inner\_class\_name>", "fields": \[ {"name": "productId", "type": \["string", "null"\]}, {"name": "keywords", "type": \["string", "null"\]} \]}}, {"name": "start", "type": \["string", "null"\]} \]}