Skip to content

[GG-1690] Migrate REST docs to OpenAPI spec + Slate generator#124

Open
dgra wants to merge 1 commit into
mainfrom
GG-1690-openapi-migration
Open

[GG-1690] Migrate REST docs to OpenAPI spec + Slate generator#124
dgra wants to merge 1 commit into
mainfrom
GG-1690-openapi-migration

Conversation

@dgra

@dgra dgra commented Jun 15, 2026

Copy link
Copy Markdown
Member

What & why

Makes OpenAPI 3.1 the source of truth for the REST API docs, while keeping the public Slate site (developer.drip.com) unchanged. Redoc renders the aggregator spec/rest-v2.yaml; a custom stdlib-only Ruby generator (lib/openapi_slate.rb, via script/generate-docs) reproduces the existing source/includes/rest/_*.md partials.

Stacked on GG-1690_sec_api (the Single-Email Campaign write-API doc) since the broadcasts fragment builds on it — so this PR's diff is just the migration.

Structure

  • spec/rest-v2.yaml — aggregator ($refs every path, in display order)
  • spec/components.yaml — shared parameters / responses / schemas / securitySchemes
  • spec/fragments/<resource>.yaml — one self-contained file per resource
  • Slate-only presentation lives under the x-slate vendor extension (Redoc ignores it)

Workflow

ruby script/generate-docs            # regenerate _*.md from spec/
ruby script/verify-docs              # gate: generated output matches committed md
npx @redocly/cli preview-docs spec/rest-v2.yaml

verify-docs gates on a normalized diff and reports byte diffs; redocly lint passes. See spec/README.md for the full workflow and x-slate reference.

Status

All 14 REST resources generate from the spec (verify-docs: 0 pending). Smaller resources reproduce byte-identical; the larger pages (subscribers, campaigns, workflows, broadcasts, batch_api) are regenerated as canonical output (full response JSON instead of { ... } placeholders, schema-derived tables).

Follow-up

The Batch API page's three v3 Shopper Activity batch endpoints (cart/order/product) aren't part of rest-v2; they're carried verbatim in batch_api.yaml x-slate.footer for now and should later move to a dedicated shopper-activity spec.

🤖 Generated with Claude Code

Make OpenAPI 3.1 the source of truth for the REST API docs. Redoc renders
the aggregator spec/rest-v2.yaml; a custom stdlib-only Ruby generator
(lib/openapi_slate.rb, via script/generate-docs) reproduces the existing
Slate _*.md partials so the public site stays the same.

Structure:
- spec/rest-v2.yaml: aggregator ($refs every path, in display order)
- spec/components.yaml: shared parameters/responses/schemas/securitySchemes
- spec/fragments/<resource>.yaml: one self-contained file per resource

Presentation that can't be derived from OpenAPI lives under the x-slate
vendor extension (Redoc ignores it). script/verify-docs gates on a
normalized diff and reports byte diffs; see spec/README.md for the workflow
and x-slate reference.

All 14 REST resources generate from the spec (verify-docs: 0 pending). The
smaller resources reproduce byte-identical; the larger pages (subscribers,
campaigns, workflows, broadcasts, batch_api) are regenerated as canonical
output (full response JSON, schema-derived tables).

Note: the Batch API page's three v3 Shopper Activity batch endpoints are
carried verbatim in batch_api.yaml x-slate.footer; they should later move to
a dedicated shopper-activity spec.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@atongen atongen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure I can fully review this, the parts I looked at looked good.

Base automatically changed from GG-1690_sec_api to main June 17, 2026 14:28
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.

2 participants