You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by "Madhire, Naveen" <Na...@capitalone.com> on 2015/11/10 21:46:05 UTC

processor for validation

Hi,

My requirement is to do validations of few json elements. For example, One of the key in Json is customerid and I need to make sure “customer_id” is always numeric.

I looked at EvaluateJsonPath, but it is more of checking against an expression.
So is there any processor which can be used for validations?


Thanks,
Naveen


________________________________________________________

The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

Re: processor for validation

Posted by Joe Witt <jo...@gmail.com>.
Naveen

The approach Matt suggested will help.  Perhaps a more complete
approach would be to be able to apply a true schema validation to JSON
documents.  I did a quick search for apache friendly Java libraries
and found this [1].  Perhaps we should have a processor that lets
users validate JSON documents using such an approach.

Do you think this could help you?

Thanks
Joe

[1] https://github.com/everit-org/json-schema

On Tue, Nov 10, 2015 at 8:35 PM, Matthew Clarke
<ma...@gmail.com> wrote:
> Sorry, the java regular expression should actually be [0-9]+ instead of
> [0-9].*
>
> On Nov 10, 2015 4:57 PM, "Madhire, Naveen" <Na...@capitalone.com>
> wrote:
>>
>> Yes, this helps. I am not much familiar Nifi expressions. I found a good
>> tutorial in Apache Nifi website. I am going through that now.
>>
>> Thanks Matt.
>>
>> From: Matthew Clarke <ma...@gmail.com>
>> Reply-To: "users@nifi.apache.org" <us...@nifi.apache.org>
>> Date: Tuesday, November 10, 2015 at 3:11 PM
>> To: "users@nifi.apache.org" <us...@nifi.apache.org>
>> Subject: Re: processor for validation
>>
>> Naveen,
>>      The NiFi expression language can be used to accomplish what you are
>> looking to do. First extract the "customer_id" from the main message. Then
>> used the routeonAttribute processor to only route files where the customer
>> contains only numbers.
>>
>> ${'customer_id':matches('[0-9].*')}
>>
>>     Without looking at your json messages, I can't be specific on the
>> expression language statement to use to extract the customer_id.
>>
>> Does this help?
>>
>> Matt
>>
>> On Nov 10, 2015 3:46 PM, "Madhire, Naveen" <Na...@capitalone.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> My requirement is to do validations of few json elements. For example,
>>> One of the key in Json is customerid and I need to make sure “customer_id”
>>> is always numeric.
>>>
>>> I looked at EvaluateJsonPath, but it is more of checking against an
>>> expression.
>>> So is there any processor which can be used for validations?
>>>
>>>
>>> Thanks,
>>> Naveen
>>>
>>>
>>>
>>> ________________________________
>>>
>>> The information contained in this e-mail is confidential and/or
>>> proprietary to Capital One and/or its affiliates and may only be used solely
>>> in performance of work or services for Capital One. The information
>>> transmitted herewith is intended only for use by the individual or entity to
>>> which it is addressed. If the reader of this message is not the intended
>>> recipient, you are hereby notified that any review, retransmission,
>>> dissemination, distribution, copying or other use of, or taking of any
>>> action in reliance upon this information is strictly prohibited. If you have
>>> received this communication in error, please contact the sender and delete
>>> the material from your computer.
>>
>>
>> ________________________________
>>
>> The information contained in this e-mail is confidential and/or
>> proprietary to Capital One and/or its affiliates and may only be used solely
>> in performance of work or services for Capital One. The information
>> transmitted herewith is intended only for use by the individual or entity to
>> which it is addressed. If the reader of this message is not the intended
>> recipient, you are hereby notified that any review, retransmission,
>> dissemination, distribution, copying or other use of, or taking of any
>> action in reliance upon this information is strictly prohibited. If you have
>> received this communication in error, please contact the sender and delete
>> the material from your computer.

Re: processor for validation

Posted by Matthew Clarke <ma...@gmail.com>.
Sorry, the java regular expression should actually be [0-9]+ instead of
[0-9].*
On Nov 10, 2015 4:57 PM, "Madhire, Naveen" <Na...@capitalone.com>
wrote:

> Yes, this helps. I am not much familiar Nifi expressions. I found a good
> tutorial in Apache Nifi website. I am going through that now.
>
> Thanks Matt.
>
> From: Matthew Clarke <ma...@gmail.com>
> Reply-To: "users@nifi.apache.org" <us...@nifi.apache.org>
> Date: Tuesday, November 10, 2015 at 3:11 PM
> To: "users@nifi.apache.org" <us...@nifi.apache.org>
> Subject: Re: processor for validation
>
> Naveen,
>      The NiFi expression language can be used to accomplish what you are
> looking to do. First extract the "customer_id" from the main message. Then
> used the routeonAttribute processor to only route files where the customer
> contains only numbers.
>
> ${'customer_id':matches('[0-9].*')}
>
>     Without looking at your json messages, I can't be specific on the
> expression language statement to use to extract the customer_id.
>
> Does this help?
>
> Matt
> On Nov 10, 2015 3:46 PM, "Madhire, Naveen" <Na...@capitalone.com>
> wrote:
>
>> Hi,
>>
>> My requirement is to do validations of few json elements. For example,
>> One of the key in Json is customer*id and I need to make
>> sure “customer_id” is always numeric. *
>>
>> I looked at EvaluateJsonPath, but it is more of checking against an
>> expression.
>> So is there any processor which can be used for validations?
>>
>>
>> Thanks,
>> Naveen
>>
>>
>>
>> ------------------------------
>>
>> The information contained in this e-mail is confidential and/or
>> proprietary to Capital One and/or its affiliates and may only be used
>> solely in performance of work or services for Capital One. The information
>> transmitted herewith is intended only for use by the individual or entity
>> to which it is addressed. If the reader of this message is not the intended
>> recipient, you are hereby notified that any review, retransmission,
>> dissemination, distribution, copying or other use of, or taking of any
>> action in reliance upon this information is strictly prohibited. If you
>> have received this communication in error, please contact the sender and
>> delete the material from your computer.
>>
>
> ------------------------------
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
>

Re: processor for validation

Posted by "Madhire, Naveen" <Na...@capitalone.com>.
Yes, this helps. I am not much familiar Nifi expressions. I found a good tutorial in Apache Nifi website. I am going through that now.

Thanks Matt.

From: Matthew Clarke <ma...@gmail.com>>
Reply-To: "users@nifi.apache.org<ma...@nifi.apache.org>" <us...@nifi.apache.org>>
Date: Tuesday, November 10, 2015 at 3:11 PM
To: "users@nifi.apache.org<ma...@nifi.apache.org>" <us...@nifi.apache.org>>
Subject: Re: processor for validation


Naveen,
     The NiFi expression language can be used to accomplish what you are looking to do. First extract the "customer_id" from the main message. Then used the routeonAttribute processor to only route files where the customer contains only numbers.

${'customer_id':matches('[0-9].*')}

    Without looking at your json messages, I can't be specific on the expression language statement to use to extract the customer_id.

Does this help?

Matt

On Nov 10, 2015 3:46 PM, "Madhire, Naveen" <Na...@capitalone.com>> wrote:
Hi,

My requirement is to do validations of few json elements. For example, One of the key in Json is customerid and I need to make sure “customer_id” is always numeric.

I looked at EvaluateJsonPath, but it is more of checking against an expression.
So is there any processor which can be used for validations?


Thanks,
Naveen



________________________________

The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
________________________________________________________

The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

Re: processor for validation

Posted by Matthew Clarke <ma...@gmail.com>.
Naveen,
     The NiFi expression language can be used to accomplish what you are
looking to do. First extract the "customer_id" from the main message. Then
used the routeonAttribute processor to only route files where the customer
contains only numbers.

${'customer_id':matches('[0-9].*')}

    Without looking at your json messages, I can't be specific on the
expression language statement to use to extract the customer_id.

Does this help?

Matt
On Nov 10, 2015 3:46 PM, "Madhire, Naveen" <Na...@capitalone.com>
wrote:

> Hi,
>
> My requirement is to do validations of few json elements. For example, One
> of the key in Json is customer*id and I need to make sure “customer_id”
> is always numeric. *
>
> I looked at EvaluateJsonPath, but it is more of checking against an
> expression.
> So is there any processor which can be used for validations?
>
>
> Thanks,
> Naveen
>
>
>
> ------------------------------
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
>