Skip to content

feat(schemas): add JSON schema for additional documentation summary.json - #1766

Open
officialbidisha wants to merge 2 commits into
compodoc:developfrom
officialbidisha:feat/summary-json-schema
Open

officialbidisha wants to merge 2 commits into
compodoc:developfrom
officialbidisha:feat/summary-json-schema

Conversation

@officialbidisha

Copy link
Copy Markdown

Fixes #1414.

Problem: the "Additional documentation" feature (--includes flag) is driven by a hand-written summary.json file, but its shape (array of { title, file, children? } entries, up to 5 levels deep, per the traversal in Application.prepareExternalIncludes) is undocumented. As noted in #1414 and the related #577, editors like VS Code can't offer autocomplete or catch typos without a schema to associate with the file.

Change: adds schemas/summary.schema.json, a draft-07 JSON Schema describing that shape (title and file required strings, optional recursive children array). Since package.json has no "files" allowlist, this gets published as-is, so users can point their editor at it, e.g. via a json.schemas entry in .vscode/settings.json referencing ./node_modules/@compodoc/compodoc/schemas/summary.schema.json.

Testing: added test/src/schemas/summary.schema.spec.ts, which asserts the schema requires title/file, validates the real fixture at test/fixtures/todomvc-ng2/additional-doc/summary.json against it, and confirms an entry missing a required field is flagged. No application code changed.

This branch has not been deployed

No deployments
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.

[FEATURE] Provide a JSON Schema for sumary.json

1 participant