Prototype OpenAPI proxify#200
Draft
mmkal wants to merge 2 commits into
Draft
Conversation
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an experimental
openapiProxifyruntime helper that turns an already-loaded OpenAPI 3.x JSON document into the existing noRPC router shape, socreateClican expose OpenAPI operations as fetch-backed CLI commands without codegen or new runtime dependencies.The prototype supports operation naming from
operationId, path/query/header parameters, static or dynamic request headers, JSON request bodies, JSON/text response parsing, and useful non-2xx errors viaOpenApiProxifyHttpError.Usage
OpenAPI Helper Tradeoffs
I kept this dependency-free for the prototype. Current primary-source checks on 2026-05-05:
openapi-fetch@0.17.0is still the most attractive small fetch runtime, but the official docs position its core value around generatedpathstypes fromopenapi-typescript; it is not a runtime OpenAPI document parser. The docs describe it as a 6 kB, near-zero-runtime fetch client, with nativefetch, generatedpaths, Node >=18 support, and path/query/body serializer hooks.@hey-api/openapi-ts@0.97.1is a broader codegen system. Its docs describe production TypeScript output, Fetch/Axios/etc. clients, plugins, and Node.js 22+ support.npm viewconfirmsengines.node: >=22.13.0, which does not fit this package's Node >=18 target as a required dependency.npm view openapi-fetch@0.17.0 ...confirmed MIT license, one runtime dependency (openapi-typescript-helpers), and ~229 kB unpacked size.npm view @hey-api/openapi-ts@0.97.1 ...confirmed MIT license, Node>=22.13.0, multiple codegen dependencies, and ~2.6 MB unpacked size.Sources:
Tests
pnpm exec vitest run test/openapi-proxify.test.tspnpm compilepnpm lintpnpm testLimitations
#/...refs only.application/jsonrequest bodies. Cookies, multipart, form-urlencoded, and non-JSON request bodies are out of scope.