Shawn,

Your schema indicates that the fields are optional because of the
"type" :  ["null", "string"] , so IIRC they won't be marked as invalid
because they are treated as null (I'm not sure there's a difference in
the code between missing and null fields).

You can try "type": "string" in ValidateRecord to see if that fixes
it, or there's a "StrNotNullOrEmpty" operator in ValidateCSV.

Regards,
Matt

On Mon, Jan 6, 2020 at 4:35 PM Shawn Weeks <[email protected]> wrote:
>
> I’m trying to validate that a csv file has the number of fields defined in 
> it’s Avro schema. Consider the following schema and CSVs. I would like to be 
> able to reject the invalid csv as missing fields.
>
>
>
> {
>
>    "type" : "record",
>
>    "namespace" : "nifi",
>
>    "name" : "nifi",
>
>    "fields" : [
>
>       { "name" : "c1" , "type" :  ["null", "string"] },
>
>       { "name" : "c2" , "type" : ["null", "string"] },
>
>       { "name" : "c3" , "type" : ["null", "string"] }
>
>    ]
>
> }
>
>
>
> Good CSV
>
> c1,c2,c3
>
> hello,world,1
>
> hello,world,
>
> hello,,
>
>
>
> Bad CSV
>
> c1,c2,c3
>
> hello,world,1
>
> hello,world
>
> hello
>
>

Reply via email to