docs: generate a frontmatter description for API reference pages - #1765
Merged
Conversation
Group C item 11 of the AI-readiness audit. The 59 pages under developer-tools/snyk-api/reference are generated from the OpenAPI spec by this tool, so the 68-page description pass in PR 1757 deliberately skipped them: a hand-edited description would be overwritten on the next hourly sync. This adds the description at the point the page is written, so every reference page carries one and it survives regeneration. GitBook reads the description from frontmatter, which must precede the H1, so the block is emitted first. The text is derived from the category label rather than hand-written per page. Tested in CI: Go is not available in the authoring environment, so the new tests were not run locally. test-generator.yml builds and runs them on this PR. Co-Authored-By: Claude Opus 5 (1M context) <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. |
mihaisau-snyk
approved these changes
Sep 9, 2026
The unparam linter flagged createTempFile because every call site passes the same literal, which the new frontmatter test made unambiguous. Move the literal into the helper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
AI review
No style or structural issues found.
Verified: tools/api-docs-generator successfully generates valid YAML frontmatter description blocks on reference documentation pages · test coverage in reference_docs_test.go confirms description positioning before the top-level H1 heading · test suite passes with make test.
The current head commit 6b77146 is reviewed.
Sent by Cursor Automation: PR review for User Docs
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.


Group C item 11 of the September 2026 AI-readiness audit.
The question this answers
The audit asked whether the ~60 pages under
developer-tools/snyk-api/reference/are generated by a pipeline, because that determines the whole approach. They are:tools/api-docs-generator/config.ymlsetsapiReferencePath: developer-tools/snyk-api/reference, and the sync workflow runs hourly.That is why PR #1757, which added descriptions to 68 pages, deliberately skipped these 59. A hand-edited description would be erased on the next sync. The fix belongs in the generator.
The change
renderReferenceDocsPagenow emits a frontmatterdescriptionbefore the H1. GitBook reads the page description from frontmatter, and it must be the first thing in the file.The text is derived from the category label rather than written per page, so all 59 get one and any future endpoint group is covered automatically.
Why it matters
A page with no description gives search results and AI assistants nothing to quote. The API reference is 59 of the 146 pages the audit found missing one — the single largest block, and the only one that could not be fixed by editing Markdown.
Testing
Two tests are added: one asserting the rendered page starts with a frontmatter description and that it precedes the H1, one covering the description helper directly.
These were not run locally. Go is not installed in the authoring environment, so I verified the change by inspection only.
test-generator.ymlbuilds and runs the suite on this PR — please treat CI as the real check. If the build fails, the likely cause is thestringsimport I added to the test file.After merge
The next scheduled run of
sync-api-docsregenerates the 59 pages with descriptions. No manual step is needed, but it is worth confirming on the first auto-generated PR that the frontmatter renders as expected in the GitBook preview.Note
Low Risk
Docs-generator output-only change with unit tests; regenerated reference pages pick up descriptions on the next sync.
Overview
The API reference doc generator now prepends GitBook frontmatter with an auto-generated
description(before the H1) on everyrenderReferenceDocsPageoutput, via new helperreferencePageDescriptionthat formats text from the category label.Tests assert the description block is first in the file and stays single-line; existing render tests were adjusted for a simpler temp-file helper.
Reviewed by Cursor Bugbot for commit 6b77146. Bugbot is set up for automated code reviews on this repo. Configure here.