nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Witt <joe.w...@gmail.com>
Subject Re: Required, either-or properties
Date Thu, 12 May 2016 17:56:05 GMT
Russ,

Yeah - I recommend you mark them both optional then use customValidate
to check for 'should never happen cases' and then provide validation
errors for this scenarios which explain to the user proper handling.
You can also use the PropertyDescriptor of each property to explain
its intended relationship to other properties.

Does that seem like it will take care of your case?

Thanks
Joe

On Thu, May 12, 2016 at 1:35 PM, Russell Bateman
<russell.bateman@perfectsearchcorp.com> wrote:
> Joe,
>
> Thanks for your reply.
>
> As I'm thinking about it, validation of the property value isn't so much my
> problem. It's documentation.
>
> If I mark the property documentation for both properties as required, then
> my consumer will wonder what supplying both would mean. However, one of the
> two, but never both is required. If both are supplied (whatever that would
> mean in the mind of the consumer), I ignore the template on the filesystem
> path since I check for the existence of the direct content property first.
>
> Is this dilemma a candidate for the /customValidate/ method you mention?
>
> Best,
> Russ
>
>
> On 05/12/2016 11:28 AM, Joe Witt wrote:
>>
>> Russell,
>>
>> Validators on property descriptors help with validating that property
>> alone.  But in the processor API there is 'customValidate' method you
>> can implement which is used to do things like compound/conditional
>> validation.
>>
>> Thanks
>> Joe
>>
>> On Thu, May 12, 2016 at 1:25 PM, Russell Bateman
>> <russell.bateman@perfectsearchcorp.com> wrote:
>>>
>>> How are folk specifying processor properties in the case where one of two
>>> properties is required, but not both? I'm just wondering if there's a
>>> best
>>> practice here or must I say something in the description?
>>>
>>> For example, I've written a processor that implements Apache Velocity
>>> templating. I require the template content be passed either directly as
>>> the
>>> value of a property, "Template content", or a filesystem path to this
>>> content in a property, "Template filepath".
>>>
>

Mime
View raw message