Skip to content

Add a developer guide, an OpenAPI spec and search examples - #7

Merged
davd-gzl merged 1 commit into
mainfrom
train-api-developer-docs-8o6zaw
Oct 5, 2026
Merged

davd-gzl merged 1 commit into
mainfrom
train-api-developer-docs-8o6zaw

Conversation

@davd-gzl

@davd-gzl davd-gzl commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Before: someone wanting to build on the API had to read docs/format.md and the build code to learn the endpoints, decode the compact format, and work out what they may do with the data.

After: docs/developers.md is a single page for them, linked from the README. It covers a quick start, every endpoint, the compact format with copyable decoders in JS and Python, what the fields mean (local times, per-operator station ids, seatKnown), freshness and caching, the MAX seat archive, a licence and credit line per operator, and a stability promise for /v1/. docs/openapi.yaml (OpenAPI 3.1) describes every file for Swagger UI, Postman or code generators. examples/search.mjs and examples/search.py search one day between two stations with no dependencies.

The promise to review before merging: /v1/ only gets additive changes; clients ignore unknown keys and any element after the seventh in a compact train; a breaking change ships as /v2/ with /v1/ kept published for at least 6 months.

How: docs and example files only, plus six lines in the README. Nothing in src/ or the workflows changes, and the branch merges cleanly with #6 (which should add gb and se to the guide's licence table when it lands). Checked: the spec validates as OpenAPI 3.1; every file of the fixture build and a fixture MAX archive validate against its schemas; both examples return the expected trains against the fixture build served locally; npm run check passes. CORS and cache headers are GitHub Pages' standard behaviour and weren't confirmed against the live site.

Anyone can now build on the public API without reading the build code:
endpoints, the compact format with decoders in JS and Python, caching,
licences and the credit each operator asks for, and a stability promise
for /v1/. docs/openapi.yaml describes every file and was checked against
a fixture build.
@davd-gzl davd-gzl self-assigned this Oct 5, 2026
@davd-gzl
davd-gzl merged commit 40c19d8 into main Oct 5, 2026
2 checks passed
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