Hi David,

Thanks for creating the template. I can see the issue with a little bit of 
debugging. I went ahead and created a JIRA to address it [1]. Unfortunately, I 
don't know that there's a good way to work around this problem. Typically when 
a timestamp field is parsed in JSON, it gets converted into an appropriate 
Timestamp object. But with ValidateRecord, it parses a few things differently, 
and intentionally avoids some of the type coercion so that the processor is 
able to check the raw data to ensure that it is valid. For timestamps, though, 
this logically needs to be modified a bit.

Thanks
-Mark

[1] https://issues.apache.org/jira/browse/NIFI-6369

On Jun 7, 2019, at 2:58 PM, David Gallagher 
<dgallag...@cleverdevices.com<mailto:dgallag...@cleverdevices.com>> wrote:

Hi Mark - attached.

Thanks,

Dave

From: Mark Payne <marka...@hotmail.com<mailto:marka...@hotmail.com>>
Sent: Thursday, June 6, 2019 12:06 PM
To: users@nifi.apache.org<mailto:users@nifi.apache.org>
Subject: Re: Question on ValidateRecord w/ Timestamps

David,

Can you send a template of your flow and a sample piece of data?

Thanks
-Mark



On Jun 6, 2019, at 11:47 AM, David Gallagher 
<dgallag...@cleverdevices.com<mailto:dgallag...@cleverdevices.com>> wrote:

Thanks, Mark. I tried that but it causes even messages with the correct format 
to be rejected.

Dave

From: Mark Payne <marka...@hotmail.com<mailto:marka...@hotmail.com>>
Sent: Thursday, June 6, 2019 11:27 AM
To: users@nifi.apache.org<mailto:users@nifi.apache.org>
Subject: Re: Question on ValidateRecord w/ Timestamps

David,

Avro supports a logical type of "timestamp-millis" only for a long field, not 
for a String field.
So I think you'd need to use:

{"name": "activationDate", "type": { "type":"long", 
"logicalType":"timestamp-millis"} }

Thanks
-Mark



On Jun 6, 2019, at 11:21 AM, David Gallagher 
<dgallag...@cleverdevices.com<mailto:dgallag...@cleverdevices.com>> wrote:

Hi – I’ve got an incoming JSON message with a timestamp that I want to 
validate. I have a ValidateRecord (1.8.0) processor set up with a 
JSONPathReader for the message. The relevant field is defined in the schema as:

{"name": "activationDate", "type": { "type":"string", 
"logicalType":"timestamp-millis"} }

And in the JSONPathReader service, I have the timestamp format defined as:

MM/dd/yyyy HH:mm:ss'Z'

As that is our intended format. However, even with strict type checking turned 
on, the validator will validate a timestamp of “2019-30-06<tel:2019-30-06> 
15:02:39Z". In fact, it seems as though it will validate / pass on absolutely 
any string in that field. Is there a way to make the validation work?

Thanks,

Dave

<ValidateJsonTimestamp.xml>

Reply via email to