Repository navigation
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Fixes #258
This adds a schema ID check to tools/validate.js. Every event schema's
$idhas to behttps://cdevents.dev/<spec version>/schema/<subject>-<predicate>-event, built fromcontext.typeand 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-eventas 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.jslocally 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: