I am using the Apache Nifi validate record using Avro schemas against a nested Json. I am having particular problems with map fields in the JSON.
Schema:
{
"type": "record",
"name": "Test",
"namespace": "test_events",
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "test_attributes",
"type": {
"type": "record",
"name": "test_attributes.instance",
"fields": [
{
"name": "normal_field",
"type": [
"null",
"string"
]
},
{
"name": "nested_field",
"type": [
"null",
{
"type": "map",
"values": [
"null",
"int"
]
}
]
}
]
}
}
]
}
Json data:
{
"id": "aplhanum123",
"test_attributes": {
"normal_field": "normal",
"nested_field": {
"meaning": 42
}
}
}
Invalidation message:
Records in this FlowFile were invalid for the following reasons: ; The following 1 fields had values whose type did not match the schema: [/test_attributes/nested_field]
I do not understand this message. I'd imagine that nested_field in the Json is valid map and therefor should not be invalidated by the processor. What am i missing?
Edit:
* Removed the } in sample JSON.
* Nifi-1.7.1, ValidateRecord with JsonTreeReader
}. I used ValidateRecord processor with JsonTreeReader. - Christoph Bauer}in the JSON? You are correct, It is a mistake on my part. That shouldn't be there. - irrelevantUser