Skip to content

Align event field tables with the schemas and check them in CI - #343

Open
cvas22 wants to merge 1 commit into
cdevents:mainfrom
cvas22:docs-uri-fields
Open

cvas22 wants to merge 1 commit into
cdevents:mainfrom
cvas22:docs-uri-fields

Conversation

@cvas22

@cvas22 cvas22 commented Nov 22, 2026 •

Copy link
Copy Markdown

Changes

Refs #342

This fixes the field name gaps from #342. The url rows become uri to match the rename in 3e2e806, artifact published gets the sbom row its schema already has, and I dropped the severity row from testCaseRun skipped. That row came in with the skipped event as a copy from finished ('Severity if the test failed'), and the schema never had it.

I also added a step to tools/validate.js that reads the field table under each event heading and fails if it lists different fields than subject.content in the schema, so this can't drift again. It only compares names. The required-flag mismatches listed in #342 are still open, since I'm not sure which side is right there.

Submitter Checklist

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

  • Has the primer doc been updated if a design decision is involved (no design decision here)
  • Have the JSON schemas been updated if the specification changed (the docs now follow the schemas, no schema change)
  • Has spec version and event versions been updated according to the versioning policy (no event changes)
  • Meets the CDEvents contributor standards

Rename the url rows to uri to match 3e2e806, add the sbom row to
artifact published, and drop the severity row that was copied into
testCaseRun skipped. Add a check to tools/validate.js that fails when an
event table and its schema list different fields.

Refs cdevents#342

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@cvas22
cvas22 requested a review from a team as a code owner November 22, 2026 06:37

@afrittoli afrittoli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this PR, it's much appreciated!

We discussed in the past generating these docs, and that's still my preferred direction. However this PR provides a useful intermediate step until doc generation can be tackled.

One thing that your work made me realize is that we have no docs for the approval events. This is something we should have detected, and it would be great if CI could help us from making that mistake in the future.

An example of how CI could behave:

  1. Collect the event schemas. Take every top-level schemas/*.json file (the _defs/, links/ and registry/ folders are excluded automatically) and keep the ones whose context.type enum starts with dev.cdevents.
  2. Collect the documented events. Walk the docs as the PR does now. While walking, also flag any ### heading that links to conformance/ but doesn't match the heading regex, so a typo in a heading fails instead of being skipped silently.
  3. Compare the two sets:
    • An event in a doc with no schema is an error (today the script stops with a fatal error from loadJSON).
    • A schema with no doc table is an error, unless it is on the allowlist.
    • A schema with a doc table goes through the field comparison the PR already does.
  4. Allowlist the current gap, for example:
    // Event schemas with no doc section yet; remove an entry once its docs land
    const UNDOCUMENTED_EVENTS = ["approvalcreated", "approvalupdated", "approvalclosed"];
    If an allowlisted schema gets a doc table, the script should also fail, so the entry is removed and can't hide a later regression.
  5. Optionally, find the docs by search. SPEC_DOCS is hard-coded, so a new event doc that isn't added to it would never be checked. The script could scan every .md at the repo root for headings that link to conformance/.json. README.md would need excluding: it mentions the conformance folder, though not in an event heading.

This can be follow-up work if you are interested.

@cvas22

cvas22 commented Nov 23, 2026

Copy link
Copy Markdown
Author

thx! Makes sense, I'm happy to take the coverage check as a follow-up once this lands, approval events allowlisted like you sketched.

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.

2 participants