Dear Team,
I am trying to create an AVRO schema where a field can accept both string data(Expected Format 2) and a dynamic array (Expected Format 1).
AVRO schema has event/processFlow/characteristic []/value which is supposed to accept both dynamic array and string. For the “object_avro”, we are passing “object_json” as input. However as per "object_avro it is accepting only Expected Format 1 JSON block.
Kindly provide us a solution where an AVRO schema can accept both Expected Format 1 and Expected Format 2 JSON's.
Avro Schema:
{
"doc": "Sample schema to help you get started",
"fields": [
{
"name": "event",
"type": {
"fields": [
{
"name": "processFlow",
"type": {
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "characteristic",
"type": {
"items": {
"fields": [
{
"default": null,
"name": "id",
"type": [
"null",
"string"
]
},
{
"default": null,
"name": "name",
"type": [
"null",
"string"
]
},
{
"default": null,
"name": "valueType",
"type": [
"null",
"string"
]
},
{
"name": "value",
"type": {
"items": {
"type": "map",
"values": [
"string",
"null",
"int",
"boolean"
]
},
"type": "array"
}
},
{
"default": null,
"name": "baseType",
"type": [
"null",
"string"
]
},
{
"default": null,
"name": "schemaLocation",
"type": [
"null",
"string"
]
},
{
"default": null,
"name": "type",
"type": [
"null",
"string"
]
}
],
"name": "characteristic",
"type": "record"
},
"type": "array"
}
}
],
"name": "processFlow",
"type": "record"
}
}
],
"name": "event",
"type": "record"
}
}
],
"name": "processFlowManagement",
"namespace": "value.stc.b2b.processFlowManagement",
"type": "record"
}
Expected Format 1
"value":[
{
"name":{"string":"abcd"},
"partnerId":{"int":123},
"partnerType":{"boolean":true}
},
{
"custom":{"string":"abcd"},
"id":{"int":123},
"partnerType":{"boolean":true}
}
]
Expected Format 2
"value":{"string":"hello"}
has context menu