cloudevents/sdk-java

Custom validation for context attributes in wrapper library

Opened this issue · 1 comments

Hi Team,

What is the way to add a custom validation for cloudevents?
My requirement - I want to add some mandatory validation w.r.t our organization and keep this in our cloudevents wrapper library. This wrapper library will be used by hundreds of customer. By adding this in our library we are avoiding each validation to be added by each customer. Basically, we want to generalize the validation in wrapper library according to our organization need.

Let's say I want to check whether some context attributes added or not from our organization perspective?
I see that build method in CloudEventBuilder class has mandatory validation for source, type and id(link). Similarly I want to check this for context attributes when we call build method. Pls suggest if there is any other good way other than this.

Regards

Hi @touchkey, currently, there isn't a native way of adding additional validations