cloudevents / cloudevents/sdk-java

Custom validation for context attributes in wrapper library

Open
#592 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
446
Forks
172
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with core/src/main/java/io/cloudevents/core/v1/CloudEventBuilder.java, especially the build method and its existing source, type, and id validation. Determine whether the SDK should expose an extension point for organization-specific context-attribute validation; done would be a documented, usable approach for wrapper libraries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.