Skip to content

feat(swift-docs): Swift Symbol Graph → TypeDoc JSON pipeline#43

Closed
grdsdev wants to merge 9 commits into
mainfrom
claude/sweet-kowalevski-ae7aef
Closed

feat(swift-docs): Swift Symbol Graph → TypeDoc JSON pipeline#43
grdsdev wants to merge 9 commits into
mainfrom
claude/sweet-kowalevski-ae7aef

Conversation

@grdsdev

@grdsdev grdsdev commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

What

Adds scripts/swift-docs/ — a standalone TypeScript package that converts Swift SDK symbol graphs into TypeDoc-compatible JSON for the Supabase docs pipeline. Also ships a ready-to-copy CI workflow for supabase/supabase-swift.

Why

The supabase/supabase docs site already has a TypeDoc-based reference pipeline for JavaScript. This wires Swift into the same pipeline so the Swift v2 reference at supabase.com/docs/reference/swift/v2 is generated automatically from source instead of maintained by hand in a YAML spec.

How it works

swift package dump-symbol-graph
        ↓
.build/<arch>/symbolgraph/*.symbols.json   (one per module)
        ↓
scripts/swift-docs   (Extract → Transform → Emit)
        ↓
TypeDoc-compatible JSON   (same schema as supabase-js uses)
        ↓
supabase/supabase build-reference-content.ts   →   docs site

Key design decisions

  • swift package dump-symbol-graph (Swift 6 compatible) instead of the old swift build -Xswiftc -emit-symbol-graph-dir flag which broke in Swift 6
  • Module → category mapping via supabase-swift-categories.json: Auth→Authentication, PostgREST→Database, Realtime→Realtime, Storage→Storage, Functions→Edge Functions, Supabase→Client. Categories are injected as @category TypeDoc blockTags, which the docs pipeline requires for visibility
  • Cross-module extension files excluded (Auth@Foundation.symbols.json etc) — only primary module files are processed
  • Helpers/TestHelpers unmapped → no @category → hidden from docs automatically
  • Umbrella module naming — project name is taken from the Supabase module when present

Changes

scripts/swift-docs/ (new package)

File Purpose
src/symbol-graph.ts TypeScript types for Swift Symbol Graph JSON
src/typedoc-types.ts TypeScript types for TypeDoc JSON output
src/doc-comment.ts Parses Swift doc comments (traditional + DocC style) into TypeDoc blockTags
src/transform.ts Converts Symbol Graph → TypeDoc JSON; handles 11 Swift kinds, type parsing, hierarchy, @category injection
src/extract.ts Runs swift package dump-symbol-graph, reads .build/<arch>/symbolgraph/
src/index.ts CLI: tsx src/index.ts <sdk-root> [output.json] [categories.json]
supabase-swift-categories.json Default module→category map for supabase-swift
generate-swift-docs.yml Ready-to-copy workflow for supabase/supabase-swift

41 tests across doc-comment parser and transform core.

.github/workflows/aggregate-capabilities.yml

No changes from main — the Swift docs generation lives in supabase-swift, not here.

Companion PRs

  • supabase/supabase-swift#1034 — adds the generate-swift-docs.yml workflow; publishes to supabase.github.io/supabase-swift/v2/spec.json
  • supabase/supabase#47232 — wires Swift v2 into the TypeDoc reference pipeline (config, partials, Makefile target, SUPPORTS_NEW_REFERENCE_PROCESS)

Test plan

  • cd scripts/swift-docs && npm test — 41 tests pass
  • npm run typecheck — clean
  • Manual e2e: npx tsx src/index.ts /path/to/supabase-swift typedoc.json supabase-swift-categories.json produces valid JSON with SupabaseClient (category: Client) and AuthClient (category: Authentication)

grdsdev added 9 commits June 23, 2026 06:54
Add module-to-category mapping to transformSymbolGraph so Swift module
names (Auth, PostgREST, etc.) map to TypeDoc @category labels required
by the Supabase docs pipeline. Extend the CLI to accept an optional
categories JSON file as a third argument.

Add supabase-swift-categories.json as the default mapping for the
supabase-community/supabase-swift SDK.

Wire the generate-swift-docs job into aggregate-capabilities.yml: a
macOS runner checks out supabase-swift, runs swift-docs, and uploads
the TypeDoc JSON as an artifact; the ubuntu deploy job downloads it
into site/swift/ before publishing to GitHub Pages.

The generated JSON will be served at supabase.github.io/sdk/swift/typedoc.json
for consumption by the apps/docs Makefile in supabase/supabase.
…pace, complete fixture and tests

Switch extractor to swift package dump-symbol-graph (Swift 6 compatible);
output lands in .build/<arch>/symbolgraph/. Skip cross-module extension
files and tolerate non-zero exit for test-only targets that can't load on
the current platform.

Fix two real-world edge cases found during e2e testing against supabase-swift:
- functionSignature.returns absent on Void functions → Void intrinsic type
- functionSignature.parameters absent on zero-param methods → no parameters field

Use umbrella Supabase module name as the TypeDoc project name when present.

Fix CI repository name to supabase/supabase-swift.
…ggregate workflow

TypeDoc JSON should be hosted on supabase-swift's own GitHub Pages
(supabase.github.io/supabase-swift/v2/spec.json), mirroring the JS
pattern where each SDK repo publishes its own spec. This keeps
aggregate-capabilities.yml focused on the compliance matrix.

Add generate-swift-docs.yml as a ready-to-copy workflow template for
supabase/supabase-swift. It checks out this sdk repo for the swift-docs
tool, generates TypeDoc JSON, and publishes to GitHub Pages.
@grdsdev

grdsdev commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Closing — the swift-docs tool has been moved to supabase/supabase-swift where it belongs alongside the SDK it serves. The CI workflow in that repo now uses the local copy rather than checking out supabase/sdk. See supabase/supabase-swift#1034.

@grdsdev grdsdev closed this Jun 24, 2026
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