Repository navigation
API docs generator: keep developer-tools SUMMARY in sync - #1897
Merged
Merged
Conversation
The generator created reference pages but only printed a suggested menu into the PR body, so new pages (for example model.md in #1893) were merged without a SUMMARY.md entry and never appeared in the docs site navigation. The "matches current summary" check could also never pass, because it compared repo-root, unindented paths against SUMMARY's indented, section-relative links, so the menu was printed on every run. The generator now rewrites the children of the Reference entry in SUMMARY.md: it adds new pages in alphabetical order, removes entries for pages it no longer generates, and keeps existing lines and their labels as they are. A run with no new or removed pages leaves SUMMARY.md unchanged, and the PR body lists only the entries that changed. Also merge tags that render to the same file (OpenSourceSettings and OpensourceSettings). Previously the second render overwrote the first, so which endpoints appeared depended on map iteration order; GET /orgs/{org_id}/settings/opensource is currently missing from the published page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
esabou-snyk
approved these changes
Oct 1, 2026
Contributor
There was a problem hiding this comment.
AI review
No style or structural issues found in the documentation content.
Verified: the documentation change updates tools/api-docs-generator/README.md to accurately describe the Reference section sync behavior in developer-tools/SUMMARY.md · numbered list structure and formatting align with existing documentation · remaining changes modify the Go generator source code and test suite.
The current head commit 74d87f3 is reviewed.
Sent by Cursor Automation: PR review for User Docs
tinygrasshopper
approved these changes
Oct 6, 2026
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.


Problem
The API docs generator creates reference pages but never adds them to
developer-tools/SUMMARY.md. It only prints a suggested menu into the automated PR's description. GitBook shows only the pages thatSUMMARY.mdlists, so a new page merges without appearing in the docs.snyk.io navigation. This happened withmodel.mdin #1893, which #1896 fixes by hand.The printed menu wasn't a reliable signal either. The check that decides whether to print it compared repo-root, unindented paths (
* [X](developer-tools/snyk-api/reference/x.md)) against SUMMARY's indented, section-relative links. It never matched, so the menu appeared on every run whether or not anything had changed.Change
generator/summary.go). It rewrites only the children of theReferenceentry:AIBOMandLearnare kept, and a run that adds one page changes one line.OpenSourceSettingsandOpensourceSettings, and both map toopensourcesettings.md. Previously the second render overwrote the first, and which one won depended on Go's random map order.GET /orgs/{org_id}/settings/opensourceis currently missing from the published page. The merged page uses the label that sorts first, so the result is the same on every run.Testing
go test ./...passes, including new tests for adding, removing, keeping labels, leaving the rest of the file alone, the missing-parent error, the nested-entry error, and merging labels.make dry-runagainstmainas of the Generate API docs from spec #1893 merge:SUMMARY.mdgains only+ * [Model](snyk-api/reference/model.md), byte-identical to Add Model API reference page to developer-tools SUMMARY #1896.opensourcesettings.mdregains the missingGET /orgs/{org_id}/settings/opensourceendpoint.gofmtandgo vetare clean. I couldn't run the pinned golangci-lint locally because it doesn't build on Go 1.27; CI runs it on 1.22.3.This PR contains no regenerated docs. The OpenSourceSettings fix will arrive in the next automated sync PR.
🤖 Generated with Claude Code
Note
Medium Risk
Changes docs tooling and automatically edits
SUMMARY.mdon sync; incorrect sync logic could break GitBook nav or drop hand-maintained structure, though tests and nested-entry guards mitigate this.Overview
The API docs generator writes the Reference children in
developer-tools/SUMMARY.mdduring generation so new reference pages show up in GitBook navigation, instead of only printing a suggested menu that never matched the file.syncSummary(newsummary.go) rewrites only the direct children under the Reference entry: adds missing pages in sort order, drops links for deleted generated files, preserves existing labels and order for unchanged rows, and errors on nested entries without writing. Console output and the sync workflow PR body now list added/removed SUMMARY labels only.groupPagesByFileNamemerges OpenAPI tags that share one output file (e.g.OpenSourceSettings/OpensourceSettings) so renders no longer overwrite each other nondeterministically. README documents the SUMMARY step.Reviewed by Cursor Bugbot for commit 74d87f3. Bugbot is set up for automated code reviews on this repo. Configure here.