Thanks, Mark. Appreciate you taking a look.

Dave

From: Mark Payne <[email protected]>
Sent: Monday, June 10, 2019 10:31 AM
To: [email protected]
Subject: Re: Question on ValidateRecord w/ Timestamps

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<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fissues.apache.org%2Fjira%2Fbrowse%2FNIFI-6369&data=02%7C01%7Cdgallagher%40cleverdevices.com%7Ca023c51c304044330c2a08d6edb05d1b%7Cc24ec497266d4560bcda1d93096d9d18%7C0%7C0%7C636957739068454824&sdata=A%2Bcj3ubD1J2BCunSaOjxqb3plIQCTOZhzHPoOquoRwg%3D&reserved=0>


On Jun 7, 2019, at 2:58 PM, David Gallagher 
<[email protected]<mailto:[email protected]>> wrote:

Hi Mark - attached.

Thanks,

Dave

From: Mark Payne <[email protected]<mailto:[email protected]>>
Sent: Thursday, June 6, 2019 12:06 PM
To: [email protected]<mailto:[email protected]>
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 
<[email protected]<mailto:[email protected]>> wrote:

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

Dave

From: Mark Payne <[email protected]<mailto:[email protected]>>
Sent: Thursday, June 6, 2019 11:27 AM
To: [email protected]<mailto:[email protected]>
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 
<[email protected]<mailto:[email protected]>> 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