Skip to content

COMDOX-1759: Fix broken anchor links in generated GraphQL API reference - #596

Merged
dshevtsov merged 3 commits into
mainfrom
ds/COMDOX-1759
Aug 4, 2026
Merged

COMDOX-1759: Fix broken anchor links in generated GraphQL API reference#596
dshevtsov merged 3 commits into
mainfrom
ds/COMDOX-1759

Conversation

@dshevtsov

@dshevtsov dshevtsov commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Purpose of this pull request

Fixes broken cross-page anchor links in the generated GraphQL API reference pages.

SpectaQL emits every type reference as a bare same-page anchor (e.g. [Cart!](#cart)). This worked when the full schema lived on one page, but after the reference was split across multiple pages (queries, mutations, types A–B, types C–E, etc.), those bare anchors break whenever the target type lives on a different page than the link.

The fix adds two functions to scripts/generate-spectaql-md.js:

  • collectHeadingPages — builds a map from every ### TypeName heading to the page file that contains it
  • rewriteBareAnchors — rewrites bare (#anchor) links to absolute paths (e.g. /reference/graphql/saas/types-a-b.md#attributemetadataresponse) when the anchor's target lives on a different page than the link

All autogenerated files for versions 2.4.6, 2.4.7, 2.4.8, 2.4.9, and SaaS were regenerated with the fixed links.

Affected pages

All GraphQL API reference pages across all schema versions:

Manual testing

Preview the SaaS GraphQL reference and verify that type links within query/mutation argument tables and response fields navigate to the correct page:

https://adobedocs.github.io/commerce-webapi/commerce/webapi/reference/graphql/saas/

dshevtsov and others added 2 commits August 3, 2026 17:21
SpectaQL emits type/field cross-references as bare same-page anchors
(e.g. `[Cart!](#cart)`), which only worked before the reference was
paginated into per-page query/mutation/type chunks. Have
generate-spectaql-md.js resolve each link's target heading across all
chunks of a schema version and re-point it at the correct page when the
target lands elsewhere, leaving genuinely same-page anchors untouched.

Regenerated all five schema versions (saas, 2.4.9, 2.4.8, 2.4.7, 2.4.6)
with the fix applied.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dshevtsov dshevtsov self-assigned this Aug 3, 2026
@dshevtsov dshevtsov added bug Something isn't working technical Changes to code, examples, or technical processes maintenance labels Aug 3, 2026
@github-project-automation github-project-automation Bot moved this to 📋 Needs Review in Commerce - Pull Requests Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Linter Report

Click to expand full report
═══════════════════════════════════════════════════════════════
                     LINTER REPORT
═══════════════════════════════════════════════════════════════

Generated: 2026-08-03T23:58:32.782Z
Mode: Full Linting (all rules + dead links check)
Target Directory: /home/runner/work/commerce-webapi/commerce-webapi
Skipped Rules:
  - check-frontmatter → src/pages/includes
  - missing-heading → src/pages/includes

───────────────────────────────────────────────────────────────

Files to process: 40


═══════════════════════════════════════════════════════════════
                        SUMMARY
═══════════════════════════════════════════════════════════════

  📁 Files processed:    40
  📄 Files with issues:  0
  ❌ Total errors:       0
  ⚠️  Total warnings:     0
  📋 Total issues:       0

Result: ✅ PASSED - All files passed linting successfully!

═══════════════════════════════════════════════════════════════

This comment was automatically generated by the linter bot.

@meker12 meker12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, Dima!

@github-project-automation github-project-automation Bot moved this from 📋 Needs Review to 👍 Approved in Commerce - Pull Requests Aug 4, 2026
@dshevtsov
dshevtsov merged commit 7cf8ad1 into main Aug 4, 2026
30 checks passed
@dshevtsov
dshevtsov deleted the ds/COMDOX-1759 branch August 4, 2026 14:50
@github-project-automation github-project-automation Bot moved this from 👍 Approved to 🏁 Done in Commerce - Pull Requests Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working maintenance technical Changes to code, examples, or technical processes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants