Repository navigation
Description
Summary
scripts/generate-provider-docs.mjs carries a hand-rolled block-YAML reader - indentOf, stripInlineComment, parseScalar, tokenize, parseMap, parseSeq, parseNode, subtreeLines, findKeyIndex and the line-scanning body of extractProviderModel - roughly 150 lines whose only job is to pull components.schemas.Provider.enum and components.schemas.Provider['x-provider-configs'] out of openapi.yaml.
Bun ships a YAML parser in its standard runtime (Bun.YAML.parse), and Bun is the only runtime this script is run with: the shebang is #!/usr/bin/env bun, and Taskfile.yml, ci.yml and AGENTS.md all invoke it as bun scripts/generate-provider-docs.mjs. The "runs under both bun and node (>=18)" promise in the header comment has no caller in this repo.
Checked read-only on this branch with Bun 1.4.4: for both scripts/__fixtures__/openapi.sample.yaml and the live inference-gateway/schemas main openapi.yaml (206 KB), Bun.YAML.parse(schemaText).components.schemas.Provider gives enum and x-provider-configs values that are deep-equal to what extractProviderModel returns today (18 providers).
Principle applied - clean-code: hand-rolled code the standard library already covers, plus dead code that goes with it (findKeyIndex has a withinIndentGreaterThan parameter that neither of its two callers passes). The custom reader also understands only a YAML subset - a flow sequence such as enum: [openai, groq] in the schema would not match findKeyIndex at all, so the enum would be silently ignored and the provider list would fall back to the x-provider-configs keys - a risk a real parser removes. The change is local to one function in one file. extractProviderModel keeps its signature and return shape, so buildProviders, the renderers and the test file do not change.
Acceptance Criteria
- Before:
extractProviderModelscans lines with regexes and the custom tokenizer. After: it parses withBun.YAML.parse(schemaText), readscomponents.schemas.Provider, and still returns{ enumIds, configs }withenumIdsfalling back toObject.keys(configs)when the enum is absent. - Before: a missing
Providerschema or a missingx-provider-configsblock throws a descriptiveError. After: both cases still throw the same descriptive messages (no rawTypeErroron an undefined path). - Before:
indentOf,stripInlineComment,parseScalar,tokenize,parseMap,parseSeq,parseNode,subtreeLinesandfindKeyIndexexist in the script. After: all nine are deleted, along with the "Minimal block-YAML reader" banner comment. - Before: the file header says "Zero runtime dependencies: runs under both bun and node (>=18)" and the entrypoint guard has a
pathToFileURL(process.argv[1])fallback for older node. After: the header says the script needs Bun, and the guard isif (import.meta.main)with the unusedpathToFileURLimport removed. - Before: the test file header says the suite "exercises the hand-rolled block YAML reader". After: that sentence matches the new implementation.
-
Bun.YAML.parseis confirmed available on the release pinned in.bun-version(it was verified here on 1.4.4 only). -
task generateagainst the live schema produces no diff in the five generated pages. - Existing tests still pass (
bun test,bun run format:check,bun run lint:md).
Activity
edenreich commentedon Nov 16, 2026
@infer can you work on this? use /ponytail:ponytail
inference-gateway-maintainer commentedon Nov 16, 2026
Model:
ollama_cloud/glm-5.3-flash· Action:v0.59.9· CLI:v0.262.0· View JobTodos
Pull Request
#1241
✅ Infer Result: Success
Done. Issue #1238 is implemented on branch
fix/issue-1238, pushed, and PR #1241 (ready for review): #1241What changed
scripts/generate-provider-docs.mjs(-168 lines):extractProviderModelnow doesBun.YAML.parse(schemaText)?.components?.schemas?.Providerinstead of the hand-rolled reader. Deleted all nine helpers (indentOf,stripInlineComment,parseScalar,tokenize,parseMap,parseSeq,parseNode,subtreeLines,findKeyIndex) plus the "Minimal block-YAML reader" banner. Kept the return shape{ enumIds, configs }with theObject.keys(configs)fallback, and the same descriptive error for a missing/empty Provider schema (noTypeErroron undefined paths). Header now states the Bun requirement; entrypoint guard simplified toif (import.meta.main)with thepathToFileURLfallback and import removed.scripts/generate-provider-docs.test.mjs: header sentence updated, plus 3 new tests (missing Provider schema, Provider withoutx-provider-configs, enum fallback fromx-provider-configskeys - also exercising flow mappings/sequences the old reader could not parse).Verification (all passing)
bun test- 15/15 pass; all seven renderers still byte-match the committed docsbun run format:check,bun run lint:md,bun run buildtask generatefetched the liveinference-gateway/schemas@mainschema (206 KB, 18 providers) and left the five generated pages with zero diffSkipped: couldn't invoke bun 1.3.14 itself - the sandbox has 1.3.13, where
Bun.YAML.parseverified empirically (the API exists since 1.2.x, and the repo's CI runs the pinned 1.3.14); flow-enum coverage lives in the synthetic tests, not the committed fixture. Risk: the previously unreachable "missing the x-provider-configs extension" message is gone - both failure modes now throw the existing locator message, which is what the old code actually produced for both.Model:
ollama_cloud/glm-5.3-flash· Action:v0.59.9· CLI:v0.262.0· Exit Code:0· Duration: 3m 51sTokens: 1,621,974 in · 21,171 out · 1,643,145 total (33 requests)
Tool calls: 36 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
inference-gateway-releaser commentedon Nov 17, 2026
🎉 This issue has been resolved in version 0.9.27 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀