Validating JSON Values are neither null not empty

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Validating JSON Values are neither null not empty

Eric Secules
Hello,

I am using the ValidateRecord processor and an avro schema to validate that a json documents of roughly 50 fields contains 20 required fields. For those required fields I am also supposed to validate that they are neither null not empty-string. I don't think an avro schema will help me with the value validation. From what I gather it is just for validating the keys exist and the values match a type. But there's no type for non-empty string. Is there an existing nifi pattern to do this?

Thanks,
Eric
Reply | Threaded
Open this post in threaded view
|

Re: Validating JSON Values are neither null not empty

Mark Payne
Eric,

You’re right, Avro schemas do not allow for value validation very well. I would like to add support for XML schema/XSD validation. XSD provides rich support for value validation. But it’s not something I’ve had a chance to do yet.

My recommendation would be to use QueryRecord to filter/route the records that don’t match your desired values.

-Mark

Sent from my iPhone

> On Jul 11, 2020, at 2:53 AM, Eric Secules <[hidden email]> wrote:
>
> 
> Hello,
>
> I am using the ValidateRecord processor and an avro schema to validate that a json documents of roughly 50 fields contains 20 required fields. For those required fields I am also supposed to validate that they are neither null not empty-string. I don't think an avro schema will help me with the value validation. From what I gather it is just for validating the keys exist and the values match a type. But there's no type for non-empty string. Is there an existing nifi pattern to do this?
>
> Thanks,
> Eric