Skip to content

Add URI validation for EventType Source and Schema fields#8837

Open
Kunal1522 wants to merge 1 commit intoknative:mainfrom
Kunal1522:feature/eventtype-uri-validation
Open

Add URI validation for EventType Source and Schema fields#8837
Kunal1522 wants to merge 1 commit intoknative:mainfrom
Kunal1522:feature/eventtype-uri-validation

Conversation

@Kunal1522
Copy link
Contributor

@Kunal1522 Kunal1522 commented Jan 11, 2026

Changes

Fixes #8836
This PR addresses the TODO comments in eventtype_validation.go by adding validation for the Source and Schema URI fields in EventTypeSpec.
Before: An EventType could be created with empty Source/Schema URIs (e.g., "source": ""), which would parse successfully but result in a meaningless empty URI.
After: If Source or Schema is provided (non-nil) but empty, validation will reject it with a clear error message.

What type of PR is this?

/kind cleanup

What this PR does

  • Adds validation in EventTypeSpec.Validate() to check that Source and Schema fields are not empty when provided
  • Adds corresponding test cases for empty URI validation

Which issue(s) this PR fixes

Fixes the following TODOs in the codebase:

  • // TODO validate Source is a valid URI.
  • // TODO validate Schema is a valid URI.

How was this tested?

go test -v ./pkg/apis/eventing/v1beta1/... -run TestEventType

@knative-prow knative-prow bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 11, 2026
@knative-prow
Copy link

knative-prow bot commented Jan 11, 2026

Hi @Kunal1522. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow bot requested review from Cali0707 and matzew January 11, 2026 14:35
@knative-prow
Copy link

knative-prow bot commented Jan 11, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Kunal1522
Once this PR has been reviewed and has the lgtm label, please assign leo6leo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@creydr
Copy link
Member

creydr commented Mar 12, 2026

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 12, 2026
Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add URI validation for EventType Source and Schema fields

2 participants