Skip to content

feat(api-docs): add externalDocs, strip absolute URLs, fix link pipeline#6953

Closed
jstirnaman wants to merge 7 commits intoapi-docs-upliftfrom
clean-squash
Closed

feat(api-docs): add externalDocs, strip absolute URLs, fix link pipeline#6953
jstirnaman wants to merge 7 commits intoapi-docs-upliftfrom
clean-squash

Conversation

@jstirnaman
Copy link
Contributor

Summary

  • Add standard OpenAPI externalDocs field to all tags.yml files that have x-related entries, using the first link as the primary doc link for spec consumers
  • Convert externalDocs to {title, href} objects in related links instead of bare URL strings
  • Strip https://docs.influxdata.com host from description/summary fields so Hugo pages use relative paths
  • Fix article generation reading from absolutified download spec — introduce hugoSpecPath with relative links for Hugo content pages
  • Add externalDocs.url support to absolutifyLinks() for downloadable specs

Test plan

  • yarn build:api-docs:scripts compiles
  • node api-docs/scripts/dist/generate-openapi-articles.js --skip-fetch succeeds
  • Content pages have relative related hrefs (no docs.influxdata.com)
  • Download specs (static/openapi/) have absolute URLs
  • externalDocs present in download specs with absolute URLs
  • npx hugo --quiet builds without errors
  • Cypress API reference tests pass

Hugo-native templates for API
reference documentation. Operations render as server-side HTML instead
of client-side Redoc, providing faster page loads, full SEO
indexability, and consistent styling.

Architecture:
- Tag-based navigation: operations grouped by OpenAPI tag, accessed
  via tag pages only (no individual operation URLs)
- Generation script auto-discovers products from .config.yml files,
  deriving Hugo paths and menu keys from directory structure
- Per-tag JSON/YAML chunks for fast Hugo template rendering
- Inline curl examples generated from OpenAPI specs at build time

Templates (layouts/api/, layouts/partials/api/):
- tag-renderer.html: renders all operations for a tag
- operation.html: individual operation with parameters, request body,
  responses, and schema rendering
- code-sample.html: curl examples with Ask AI integration
- section-children.html: tag listing on section index pages
- all-endpoints-list.html: all operations sorted by path

Generation (api-docs/scripts/generate-openapi-articles.ts):
- Auto-discovery from .config.yml replaces hardcoded productConfigs
- Each API section generates independently (no cross-spec merging)
- Frontmatter-driven template data (specDownloadPath, articleDataKey)
- Link transformation: /influxdb/version/ placeholders resolved to
  product-specific paths

Removed:
- Redoc renderer, JavaScript components, and CSS
- Shadow DOM test infrastructure (~160 lines)
- Operation page generation (dead generatePathPages function)
- mergeArticleData() and slugifyDisplayName()

Styles (assets/styles/layouts/_api-*.scss):
- 3-column layout: sidebar, content, sticky TOC
- Theme-aware code blocks for curl examples
- Method badges (GET/POST/PUT/DELETE) with color coding
- Collapsible schema sections with depth tracking

Tests (cypress/e2e/content/api-reference.cy.js):
- Tag page rendering with operation structure
- Download button verification per section
- All-endpoints page with operation cards
- Related links from x-related OpenAPI extension
- Code sample and Ask AI link validation
Remove fingerprint interception workaround and fake GTM stubs.
Replace back-link navigation test with sidebar link assertion.
Remove generated cloud-serverless, cloud-dedicated, and clustered
API content from git tracking. Add management-api pattern to .gitignore.
The API reference tests require generated content pages that are
gitignored. Add a before() hook that detects missing content and
runs the generation pipeline, then waits for Hugo to rebuild.
# Conflicts:
#	api-docs/scripts/generate-openapi-articles.ts
…nk pipeline

- Add standard OpenAPI `externalDocs` field to all tags.yml files that
  have `x-related` entries (uses first link as the primary doc link)
- Convert `externalDocs` to `{title, href}` objects in related links
  instead of bare URL strings
- Strip `https://docs.influxdata.com` from description/summary fields
  in `transformDocLinks()` so Hugo pages use relative paths
- Fix article generation reading from absolutified download spec instead
  of the Hugo spec with relative links (new `hugoSpecPath` output)
- Add `externalDocs.url` support to `absolutifyLinks()` for downloads
@jstirnaman jstirnaman requested a review from a team as a code owner March 16, 2026 20:35
@jstirnaman jstirnaman requested review from sanderson and removed request for a team March 16, 2026 20:35
@jstirnaman
Copy link
Contributor Author

Opened in error — changes belong in #6622

@jstirnaman jstirnaman closed this Mar 16, 2026
@github-actions
Copy link
Contributor

Visual Review Skipped

Reason: Preview deployment failed

Visual review was skipped. The Copilot code review (Job 2) still ran.

To trigger visual review manually, re-run this workflow after the
preview is deployed.

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.

1 participant