Hey you all,
I am trying to publish a message which should follow a given Avro-Schema. Unfortunately the validation fails.
Any ideas what is wrong with the given message?
This is the error message:
FlixTech\AvroSerializer\Objects\Exceptions\AvroEncodingException : Could not encode record with given Schema.
Record:
“array (
‘first_name’ => ‘Hazel’,
‘last_name’ => ‘Haley’,
‘address’ =>
array (
‘street’ => ‘37274 Donnelly Lodge’,
‘city’ => ‘Port Hipolitofurt’,
‘postal_code’ => ‘77206-9298’,
‘country’ => ‘Hungary’,
),
)”Schema:
“{(string) {“type”:“record”,“name”:“Customer”,“namespace”:“com.faaren.schemas.customer”,“fields”:[{“name”:“first_name”,“type”:“string”},{“name”:“last_name”,“type”:“string”},{“name”:“address”,“type”:{“type”:“record”,“name”:“address”,“fields”:[{“name”:“street”,“type”:[“null”,“string”]},{“name”:“city”,“type”:[“null”,“string”]},{“name”:“postal_code”,“type”:[“null”,“int”]},{“name”:“country”,“type”:[“null”,“string”]}]}}]}}”
Here the Schema in Avro:
{
"fields": [
{
"name": "first_name",
"type": "string"
},
{
"name": "last_name",
"type": "string"
},
{
"name": "address",
"type": {
"fields": [
{
"name": "street",
"type": [
"null",
"string"
]
},
{
"name": "city",
"type": [
"null",
"string"
]
},
{
"name": "postal_code",
"type": [
"null",
"int"
]
},
{
"name": "country",
"type": [
"null",
"string"
]
}
],
"name": "address",
"type": "record"
}
}
],
"name": "Customer",
"namespace": "com.company.schemas.customer",
"type": "record"
}