Skip to content

Check schema $id format in validate.js - #344

Open
cvas22 wants to merge 1 commit into
cdevents:mainfrom
cvas22:schema-id-check
Open

cvas22 wants to merge 1 commit into
cdevents:mainfrom
cvas22:schema-id-check

Conversation

@cvas22

@cvas22 cvas22 commented Nov 23, 2026

Copy link
Copy Markdown

Changes

Fixes #258

This adds a schema ID check to tools/validate.js. Every event schema's $id has to be https://cdevents.dev/<spec version>/schema/<subject>-<predicate>-event, built from context.type and version.txt, since that's what SDKs use to find the schema from the event type. It also checks the file name matches the type, and that the links, registry and custom schemas use the current spec version prefix.

It found one real problem: testoutputpublished still had test-output-published-event as its $id, which #270 fixed for the other multi-word subjects but missed here. I fixed that too. No event version bump, same as #270.

I ran node validate.js locally and everything passes, and it fails with the old testoutput $id.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

SDKs build the schema URL from context.type, so every event schema
$id has to look like
https://cdevents.dev/<spec version>/schema/<subject>-<predicate>-event.
validate.js now checks that, plus the file name and the spec version
prefix on the links, registry and custom schemas.

The check caught testoutputpublished, which still had the dashed
test-output-published-event $id that cdevents#270 removed everywhere else.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@cvas22
cvas22 requested a review from a team as a code owner November 23, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need unit tests to help users

1 participant