Skip to content

Fetch the API contract from docs.substratalapps.com - #4

Merged
Adron merged 1 commit into
mainfrom
fix/api-contract-url
Nov 30, 2026
Merged

Adron merged 1 commit into
mainfrom
fix/api-contract-url

Conversation

@Adron

@Adron Adron commented Nov 30, 2026

Copy link
Copy Markdown
Member

Fixes the API contract sync workflow, which has failed on every scheduled run since mid-November.

Cause

The API docs moved from compositecode.github.io/substratalapps.com to docs.substratalapps.com, and the old openapi.yaml URL now answers 301 Moved Permanently. scripts/gen-api.sh --fetch used curl -fsS, which doesn't follow redirects. It saved nginx's redirect page as api/openapi.yaml, and Kiota then failed with OpenAPI specification version '<html> … 301 Moved Permanently …' is not supported.

CI itself stayed green. Its live-contract comparison only posts a notice, so it didn't surface the problem.

Fix

  • gen-api.sh fetches https://docs.substratalapps.com/openapi.yaml (overridable with OPENAPI_URL) and follows redirects.
  • It also refuses any download that isn't an OpenAPI 3 document, and leaves the snapshot untouched, so a future move fails with a clear message instead of inside Kiota.
  • ci.yml, api-sync.yml, README.md and api/README.md point at the new host.

Tested

  • An HTML page as OPENAPI_URL → exits 1 with the first bytes shown; api/openapi.yaml unchanged.
  • The old URL now follows its redirect and validates.

After merging

The published contract is now 1.0.0-draft.36 (157 operations; this repo has draft.9 with 124). Substratal-Version is still 1, so the change is additive. The next sync run will open its own PR with the regenerated client.

🤖 Generated with Claude Code

The API docs moved from compositecode.github.io/substratalapps.com to
docs.substratalapps.com, and the old URL now answers 301. curl -fsS
doesn't follow redirects, so api-sync.yml saved nginx's redirect page as
api/openapi.yaml and Kiota failed on it, every day since.

- gen-api.sh fetches https://docs.substratalapps.com/openapi.yaml
  (OPENAPI_URL overrides it), follows redirects, and refuses a download
  that isn't an OpenAPI 3 document instead of overwriting the snapshot.
- ci.yml's live-contract comparison and api-sync.yml's changelog link use
  the new host; so do README.md and api/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Adron
Adron merged commit 84b147b into main Nov 30, 2026
3 checks passed
@Adron
Adron deleted the fix/api-contract-url branch November 30, 2026 21:01
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