Skip to content

docs: document multi-version API support - #1993

Merged
pmcelhaney merged 4 commits into
mainfrom
copilot/docs-multi-version-api-support
May 5, 2026
Merged

docs: document multi-version API support#1993
pmcelhaney merged 4 commits into
mainfrom
copilot/docs-multi-version-api-support

Conversation

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor

Multi-version API support had no user-facing documentation — users couldn't discover the feature or know how to configure it. This PR adds the missing docs across four areas.

Summary

New feature pagedocs/features/multiple-versions.md

  • YAML config syntax (group + version fields), with a field reference table marking both as required
  • URL layout: how /<group>/<version>/... prefixes are derived
  • Annotated generated code layout: shared routes/, shared types/paths/, per-version types/<version>/, and types/versions.ts
  • Route handler authoring with $.version and $.minVersion() (generic "catalog" example, not tied to any real API)
  • REPL: grouped context/routes access
  • TypeScript narrowing details (Versioned<T,V> and minVersion() as a type predicate) moved to the bottom of the page for readers who want to understand the underlying types

docs/usage.md — added "Multiple versions" row to the features table.

docs/reference.md — new "Multiple API versions" section documenting SpecConfig.version, Versioned<T,V>, Versions, VersionsGTE, and types/versions.ts exports.

src/typescript-generator/versions-ts-generator.ts — added JSDoc to the generated Versions, VersionsGTE, and Versioned types so IDE tooltips are populated in the generated output file.

Original Prompt

Add user-facing documentation that explains how to configure and use multi-version API support: YAML config syntax, generated code layout, the Versioned type, route-handler authoring patterns, and REPL usage.

Multi-version support introduces several new concepts that need clear documentation for users:

  • How to declare multiple versions of the same API group in the config
  • The URL layout produced by the server (/<group>/<version>/...)
  • The generated code layout (types/<version>/..., shared types/paths/..., types/versions.ts)
  • How to write a route handler that serves multiple versions using the Versioned type
  • How the REPL addresses versioned context, routes, and scenarios

Manual acceptance tests

  • docs/features/multiple-versions.md exists and covers YAML config, URL layout, generated code layout, $.minVersion() handler example, and REPL usage
  • The handler example in the feature page uses a generic API (not Petstore or any specific real-world API)
  • docs/usage.md features table contains a "Multiple versions" row linking to ./features/multiple-versions.md
  • docs/reference.md "Multiple API versions" section documents SpecConfig.version, Versioned<T,V>, Versions, VersionsGTE, and types/versions.ts
  • Generating types/versions.ts for a versioned group produces Versions, VersionsGTE, and Versioned types with JSDoc comments visible in IDE hover tooltips
  • All existing versions-ts-generator tests pass

Tasks

  • Created docs/features/multiple-versions.md with config syntax, URL/code layout, handler authoring, and REPL sections; TypeScript narrowing details placed at the bottom
  • Marked version as required in the config field reference table
  • Removed the scenario-scripts-with-groups subsection (groups are orthogonal to versions)
  • Added "Multiple versions" row to the features table in docs/usage.md
  • Added "Multiple API versions" reference section to docs/reference.md
  • Added JSDoc to Versions, VersionsGTE, and Versioned in versions-ts-generator.ts

Copilot AI linked an issue May 5, 2026 that may be closed by this pull request
6 tasks
Copilot AI changed the title [WIP] Add documentation for multi-version API support docs: document multi-version API support May 5, 2026
Copilot AI requested a review from pmcelhaney May 5, 2026 01:43

@pmcelhaney pmcelhaney left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Move all information about types to the bottom of multiple-versions.md. Users don't need to know how the sausage is made, but leave it at the bottom in case they're interested.

Remove the section about using scenarios with groups, as groups are orthogonal to versions.

Comment thread docs/features/multiple-versions.md Outdated
|-------|----------|-------------|
| `source` | yes | Path or URL to the OpenAPI document |
| `group` | yes | Subdirectory name under `basePath`; must be non-empty and unique across groups (not across versions of the same group) |
| `version` | no | Version label (e.g. `"v1"`, `"v2"`). When set, the routes are mounted under `/<group>/<version>`. When omitted, routes are mounted under `/<group>`. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

version is required

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in da29251 — changed version from no to yes in the field table.

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

Move all information about types to the bottom of multiple-versions.md. Users don't need to know how the sausage is made, but leave it at the bottom in case they're interested.

Remove the section abo...

Done in da29251. Moved the "TypeScript narrowing with Versioned" and "The Versioned type" content to the bottom (after REPL usage). Also removed the "Running scenario scripts for a versioned group" subsection from the REPL section.

@pmcelhaney
pmcelhaney marked this pull request as ready for review May 5, 2026 01:53
Copilot AI requested a review from pmcelhaney May 5, 2026 01:54
@pmcelhaney
pmcelhaney enabled auto-merge May 5, 2026 01:54
@pmcelhaney
pmcelhaney added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 5ab5d61 May 5, 2026
8 of 9 checks passed
@pmcelhaney
pmcelhaney deleted the copilot/docs-multi-version-api-support branch May 5, 2026 02:02
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.

docs: document multi-version API support

2 participants