Skip to content

feat: generate provider-derived docs from canonical openapi.yaml - #340

Merged
edenreich merged 11 commits into
mainfrom
feat/wip-339
Jul 5, 2026
Merged

edenreich merged 11 commits into
mainfrom
feat/wip-339

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Auto-saved partial work from a run that was cancelled before it finished (timed out or failed). For #339 - a maintainer can review this branch and continue it; there is no automatic resume.

Run: https://github.com/inference-gateway/docs/actions/runs/28754662878

Comment thread Taskfile.yml Resolved
Comment thread Taskfile.yml Resolved
Comment thread Taskfile.yml Resolved
Comment thread scripts/generate-provider-docs.mjs Resolved
Comment thread scripts/generate-provider-docs.mjs Resolved
Comment thread scripts/generate-provider-docs.mjs Resolved
Co-authored-by: Eden Reich <[email protected]>
Co-authored-by: Eden Reich <[email protected]>
Co-authored-by: Eden Reich <[email protected]>
@edenreich

Copy link
Copy Markdown
Contributor

@claude Can you finalize this PR?

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 14m 53s —— View job


Finalized this PR

The PR added the generator machinery (script, Taskfile, overrides, fixture) and the GENERATED:* markers, but the marked regions still held the old hand-authored content - the run stopped before task generate reconciled them. I regenerated all four stale regions so the docs now match exactly what scripts/generate-provider-docs.mjs emits.

Committed (f4b8448) - docs: regenerate provider sections to match openapi schema:

configuration.md

  • Added the missing MiniMax settings block + #### MiniMax section (was absent entirely).
  • Split Ollama Cloud into its own ollamaCloudSettings const + section (was folded into ollamaSettings).
  • Renamed openAiSettings -> openaiSettings (the generator derives the const name from the schema id via camelCase).
  • Reordered every provider to the canonical schema/override order (openai, deepseek, anthropic, cohere, groq, cloudflare, ollama, ollama_cloud, google, mistral, minimax, moonshot, nvidia).
  • Restored Cloudflare's {ACCOUNT_ID} placeholder (schema value; renders literally through ConfigTable, matching the table + .env example).

supported-providers.md

  • Reordered the vision list to schema order and used the generator's casing (vision models, cloud-hosted vision models).
  • Reordered the uppercase provider list (moved DEEPSEEK to its schema position).

Also updated the PR title from wip: ... (run did not finish) to a proper conventional title.

Notes on the review comments

The 8 earlier review comments were empty suggestion blocks (removing verbose comments); their target lines were already deleted by the later "nit-picking" commits, so GitHub now reports them against non-existent lines. Nothing outstanding there.

Verification

  • Traced the generator line-by-line against openapi.sample.yaml + provider-overrides.json; the committed output is byte-for-byte what task generate produces, so task generate:check should report no drift.
  • git diff --check clean (no whitespace errors).
  • The <script setup> block is an opaque HTML block to prettier's markdown parser (that's why the pre-existing 140-char consts pass format:check), so the reproduced consts stay verbatim; the markdown regions reuse the exact list/heading style already prettier-clean on main.

Couldn't do (environment limits)

  • Run the toolchain to double-confirm - bun and node <script> are blocked by this Action's tool allowlist (node --version and read-only git/gh are allowed; the generator/prettier/markdownlint invocations are denied). If you'd like a CI-grade check from me, add Bash(bun:*) / Bash(bunx:*) to --allowedTools.

  • Wire task generate:check into CI - I can't modify .github/workflows/** (GitHub App restriction). Recommend adding a step to ci.yml so future schema drift fails the build; right now the check only exists as a local Task.

  • Regenerate configuration.md (provider-settings + config-sections)

  • Regenerate supported-providers.md (vision-list + provider-uppercase)

  • Finalize PR title

  • Commit

  • branch feat/wip-339

@inference-gateway-maintainer inference-gateway-maintainer Bot changed the title wip: [DOCS] Generate provider-derived docs from the canonical openapi.yaml (task generate) (run did not finish) feat: generate provider-derived docs from canonical openapi.yaml Jul 5, 2026
@edenreich
edenreich marked this pull request as ready for review July 5, 2026 22:02
@edenreich
edenreich requested a review from a team as a code owner July 5, 2026 22:02
@edenreich

Copy link
Copy Markdown
Contributor

@claude Can you review this? is it ready for merge?

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 5m 23s —— View job


Review: feat: generate provider-derived docs from canonical openapi.yaml

  • Read the generator script, overrides, Taskfile, and fixture
  • Verify generated output matches the marked regions in configuration.md and supported-providers.md
  • Check the minimal YAML parser for edge cases
  • Assess merge-readiness (CI wiring, correctness, gotchas)
  • Post review

Verdict

Content-wise this is safe to merge - CI is green (lint + format + build all pass) and the committed docs are internally consistent with the generator + fixture. But the PR's actual selling point (docs that cannot drift from the schema) is not yet enforced, and the committed output was only verified against the bundled fixture, not the live schema. I'd do the two "before you trust it" items below before treating the generator as a source of truth.

What I verified

  • Traced generate-provider-docs.mjs line-by-line against openapi.sample.yaml + provider-overrides.json. The emitted regions match the committed files exactly: provider order (openai -> nvidia), casing, camelCase const names (incl. ollamaCloud, openai), default URLs, auth labels (bearer/xheader/none), and the vision filter (deepseek + cloudflare correctly excluded).
  • Validation is solid: it throws on a schema provider missing an override, an override provider absent from the enum, a missing url, or an auth_type with no label. enum even has a sensible fallback to Object.keys(configs).
  • Marker injection handles both // (inside <script setup>) and `` comment styles, and is idempotent.
  • Green format:check confirms the generated tables/lists survive prettier --write unchanged (the generator's padding matches prettier's), so the round-trip is stable.

Before you trust it (not blockers to the site, but to the automation)

  1. Run task generate against the LIVE schema once and confirm zero drift. task generate / generate:check fetch inference-gateway/schemas@main - the committed output was only checked against scripts/__fixtures__/openapi.sample.yaml, which is a hand-authored stand-in. If the real openapi.yaml differs in provider order, a URL, a vision flag, or has a 14th provider, the first real run will produce a diff. I can't reach the network here to confirm, so this is the one unverified assumption in the whole PR.
  2. Wire generate:check into ci.yml. Right now nothing runs it, so docs can silently drift and CI stays green - the generator is effectively opt-in. This needs a human: the bot can't modify .github/workflows/**, and the step also needs go-task installed plus network access to the schema. Suggested step after the existing lint job:
    - uses: arduino/setup-task@v2
    - run: task generate:check

Recommendations (non-blocking)

  • Pin SCHEMA_REF. It defaults to main (the script's own header even says "pin to a tag or commit SHA for reproducible builds"). Unpinned + wired into CI means an unrelated upstream schema change can turn this repo's CI red on a PR that touched nothing. Pin to a tag/SHA and bump deliberately.
  • Add a test that consumes the fixture. The __fixtures__/ naming implies one, but nothing runs it - there's no *.test.mjs asserting the emitted regions. A tiny bun test that runs the generator with SCHEMA_FILE= the fixture and snapshots the output would turn the fixture into a real regression net and cover the hand-rolled YAML parser.
  • Parser fragility. The block-YAML reader only handles the subset the fixture uses (block maps, block-scalar sequences, |/>). Anchors/aliases, flow sequences (enum: [a, b]), or merge keys in the real schema could mis-parse or silently fall back. Well-commented and defensively validated, but tie this to item 1 - verify against the real file.

Minor

  • configuration.md "Complete Configuration Example" .env block (~lines 403-427) is hand-authored, outside the generated markers, and omits MiniMax even though this PR adds MiniMax everywhere else; it's also in a different provider order. Worth a one-line fix so the example isn't the odd one out. Fix this →
  • Nice touch escaping moonshot-v1-\*-vision-preview so the * doesn't render as markdown emphasis.
  • The 8 earlier empty review comments target lines already deleted by the "nit-picking" commits - nothing outstanding there.

Bottom line

Ship the content (CI's green, docs are correct). But the generator only prevents drift once (1) you've confirmed it reproduces against the live schema and (2) generate:check runs in CI. Until then it documents the schema at a point in time rather than enforcing it. I did not run the toolchain myself - bun/bunx are blocked by this Action's allowlist, so this review is from hand-tracing plus the green CI signal.

@edenreich

Copy link
Copy Markdown
Contributor

@claude Can you address these issues?

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 10m 38s —— View job


Addressed the review issues

  • Identify which review items are actionable here vs. human-only
  • Fix the .env "Complete Configuration Example" (add MiniMax + canonical provider order)
  • Add a fixture-based regression test (bun test) that covers the YAML parser + all renderers
  • Wire the test into package.json + Taskfile.yml
  • Document the human-only items (CI wiring, live-schema run, SCHEMA_REF pin)
  • Commit

I picked off the review items I could do and verify in this environment (unlike the earlier runs, bun was available here, so these are actually executed, not just hand-traced).

What I changed

1. Fixture regression test (32105d4) - addresses "Add a test that consumes the fixture" and "Parser fragility"

  • scripts/generate-provider-docs.test.mjs - a bun test that builds the providers from __fixtures__/openapi.sample.yaml + provider-overrides.json and asserts all 5 generated regions (providers-table, provider-uppercase, vision-list, provider-settings, provider-config-sections) match byte-for-byte what's committed in configuration.md / supported-providers.md, plus a check that the fixture yields the 13 providers in schema order. This turns __fixtures__/ into a real regression net and exercises the hand-rolled block-YAML reader, the schema/override merge + validation, and every renderer - offline, no prettier pass.
  • Minimal refactor to generate-provider-docs.mjs: exported the pure functions the test imports and guarded the main() call behind an entry-point check (import.meta.main, with a process.argv[1] fallback for node <24) so importing the module in the test does not rewrite the docs. Output is otherwise unchanged.
  • package.json "test": "bun test" and a task test in Taskfile.yml.

2. .env example fix (3df327a) - addresses the Minor note

  • The hand-authored "Complete Configuration Example" .env block now includes MINIMAX_API_URL / MINIMAX_API_KEY and is reordered to the canonical provider order (openai -> nvidia), so it matches the generated provider sections instead of being the odd one out.

Verification (run in this job)

  • bun test scripts/generate-provider-docs.test.mjs -> 6 pass / 0 fail. (Because it passes, the entry-point guard works - the import didn't run main() and clobber the docs.)
  • bunx prettier --check on all 5 changed files -> "All matched files use Prettier code style!" (scripts/ is not in .prettierignore, so the new .mjs/.yml/.json are covered by CI's format:check).
  • bun run lint:md -> clean. git status -> only the intended 5 files, no bun.lock drift.

Still needs a human (can't do from the bot)

  1. Wire the checks into ci.yml. I can't modify .github/workflows/** (GitHub App restriction). The test is offline and safe to run anywhere; generate:check additionally needs go-task + network to fetch the schema. Suggested step after the lint job:

    - run: bun test # offline; fixture-based regression net
    - uses: arduino/setup-task@v2
    - run: task generate:check # fetches the live schema; fails on drift
  2. Run task generate against the LIVE schema once. The committed output is verified against the bundled fixture only; the first real run against inference-gateway/schemas@main is the one thing still unconfirmed (needs network, which this job doesn't have). The new test guards the fixture path; it can't catch a live-schema difference.

  3. Pin SCHEMA_REF. I deliberately left this at main rather than guess a tag/SHA - pinning to a ref that doesn't exist would break the generator, and choosing which schema version to track is a deliberate call. When you pick one, set it in Taskfile.yml (vars.SCHEMA_REF) and the default on generate-provider-docs.mjs:37.

@edenreich

edenreich commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

@claude Can you add documentation to the commands you just added (CLAUDE.md, AGENTS.md and README.md) ? and let's add all the missing bun scripts to taskfile so they are simply delegated (Taskfile -> package.json).

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 4m 55s —— View job


Done - documented the new commands + delegated all bun scripts in the Taskfile

  • Add missing bun scripts to Taskfile.yml as delegated tasks (bun run <script>)
  • Document the new commands in CLAUDE.md (generator + task + bun test)
  • Document the new commands in AGENTS.md
  • Document the new commands in README.md
  • Verify toolchain (prettier, markdownlint, tests, task --list)
  • Commit (6b80055)

Taskfile.yml - delegation to package.json

Added a delegated task for every bun script that was missing one, so task <name> and bun run <name> are now interchangeable:

task delegates to
task dev bun run dev
task build bun run build
task preview bun run preview
task format bun run format
task format:check bun run format:check
task lint:md bun run lint:md
task lint:md:fix bun run lint:md:fix
task test bun run test (was calling bun test directly - now delegates too)

The generator-only tasks (generate, generate:check) stay Taskfile-native since they have no package.json equivalent (they use env vars + task deps). task --list now shows all 11 targets.

Documentation

  • CLAUDE.md - added bun test to the Commands block, a note that the Taskfile.yml mirrors every bun script (task <name> == bun run <name>) plus the two generate tasks, and a new architecture subsection "Provider docs are generated from the canonical OpenAPI schema" covering the GENERATED:* markers, the five generated regions, where to edit (schema vs. provider-overrides.json, never inside markers), and generate / generate:check / test.
  • AGENTS.md - added bun test + the task mirror and generate tasks to the command list, and extended Testing Guidelines to describe the fixture-based regression suite.
  • README.md - added bun test to the Development block and a short paragraph on the Taskfile.yml mirror + the task generate / generate:check schema generator.

Verification (run in this job)

  • bunx prettier --check Taskfile.yml README.md CLAUDE.md AGENTS.md -> all match Prettier code style
  • bun run lint:md -> clean
  • bun test -> 6 pass / 0 fail
  • task --list -> all 11 tasks parse (colon-named format:check / lint:md / lint:md:fix work like the existing generate:check)
  • task test -> delegation confirmed end-to-end (task test -> bun run test -> bun test, 6 pass)
    · branch feat/wip-339

@edenreich
edenreich merged commit 796e48d into main Jul 5, 2026
1 check passed
@edenreich
edenreich deleted the feat/wip-339 branch July 5, 2026 23:34
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 6, 2026
## [0.8.0](0.7.0...0.8.0) (2026-07-06)

### ✨ Features

* generate provider-derived docs from canonical openapi.yaml ([#340](#340)) ([796e48d](796e48d))

### 🐛 Bug Fixes

* **ci:** release notes are not being generated ([7c65e03](7c65e03))

### 👷 CI

* **claude:** centralize claude.yml via reusable workflow ([#341](#341)) ([e382f6b](e382f6b))
* **deps:** update inference workflow to version 0.15.1 ([e30cc1e](e30cc1e))

### 📚 Documentation

* add minimax-api-key row to github-action inputs ([#332](#332)) ([d06673b](d06673b))
* add nvidia as an adl init llm provider ([#336](#336)) ([a42ce03](a42ce03))
* add NVIDIA provider documentation ([#325](#325)) ([43076b2](43076b2))
* add NVIDIA to SDK docs and provider lists ([#328](#328)) ([9d521e1](9d521e1))
* **adl-cli:** add minimax provider to reference tables ([#344](#344)) ([3e1e0c6](3e1e0c6)), references [#337](#337)
* confirm nvidia in SDK Provider enums, add TS/Go examples ([#333](#333)) ([e6332af](e6332af))
* document nvidia-api-key action input ([#338](#338)) ([68c3ace](68c3ace))
* document OTLP metrics push endpoint and GenAI semconv metric names ([#321](#321)) ([f9a5117](f9a5117))

### 🔧 Miscellaneous

* **deps-dev:** bump the bun group with 2 updates ([#327](#327)) ([c0576ed](c0576ed))
* **deps:** bump claude-code 2.1.177 -> 2.1.197, claude-code-action v1.0.164 -> v1.0.165 ([#335](#335)) ([a256e25](a256e25))
* **deps:** bump inference-gateway/.github/.github/workflows/claude.yml ([#326](#326)) ([300d6a8](300d6a8))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] Generate provider-derived docs from the canonical openapi.yaml (task generate)

1 participant