Add JSON schema and validation for examples.json#641
Open
caugner wants to merge 8 commits into
Open
Conversation
Reject values containing slashes, spaces, or other characters that would produce a broken GitHub link for the example.
Enforce the `Namespace.member` shape (e.g. `tabs.query`) so malformed entries fail validation.
Replace `ajv-cli` with a small `node validate.js` that compiles the schema with `ajv` directly. Drops the `ajv-cli` transitive tree (`glob@7`, `js-yaml@3`, `fast-json-patch`, `minimist`, ...) and prints per-error paths on failure.
Member
|
@caugner do we need a CODEOWNERS change? I suppose we should own these files? |
Rob--W
approved these changes
Jul 10, 2026
Rob--W
left a comment
Member
There was a problem hiding this comment.
Code lgtm.
do we need a CODEOWNERS change? I suppose we should own these files?
The code owner was intentionally changed to the addons team, because we are the ones who can/should review extension examples.
This linter was introduced here to make sure that mdn/rari does not break.
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.
Description
Add a JSON schema for
examples.jsonand validate it in CI.examples.schema.jsondescribing the top-level array of example entries (description,javascript_apis,name), including a directory-safepatternfornameand aNamespace.memberpatternforjavascript_apisentries.ajvas a dev dependency and avalidatescript (node validate.js, run vianpm run validate), also chained intonpm test.validatejob to thelintworkflow.Motivation
Ensure
examples.jsonstays well-formed, since it is consumed downstream (e.g. by rari to link example extensions from MDN WebExtensions API pages).Additional details
Related issues and pull requests
Fixes #640.