Repository navigation
openapi: replace hand-rolled $ref walker with @readme/openapi-parser - #353
Closed
RhysSullivan wants to merge 1 commit into
Closed
RhysSullivan wants to merge 1 commit into
RhysSullivan wants to merge 1 commit into
Conversation
parse.ts now dereferences specs via @readme/openapi-parser (6.x), which uses @apidevtools/json-schema-ref-parser under the hood. Fixes two known bugs in our previous walker: - circular $refs no longer hang — cycles preserved via object identity - RFC 6901 pointer escapes (~0, ~1) handled correctly Dereference runs with resolve.external: false so we never reach out to the network from the parser (Cloudflare Workers compatibility), and with dereference.circular: true so cyclic specs resolve without error. Broken internal $refs now surface as OpenApiParseError on the Effect channel instead of silently returning a partial extraction. DocResolver stays exported but collapses to a passthrough now that the doc is already dereferenced at parse time — extract.ts and preview.ts keep working unchanged. Adds circular-ref.test.ts and malformed-spec.test.ts covering the new behaviour; existing 36 tests (including the 16MB Cloudflare fixture) continue to pass.
This was referenced Apr 20, 2026
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Apr 20, 2026
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | 0328aea | Apr 20 2026, 10:22 PM |
@executor/sdk
@executor/plugin-file-secrets
@executor/plugin-google-discovery
@executor/plugin-graphql
@executor/plugin-keychain
@executor/plugin-mcp
@executor/plugin-oauth2
@executor/plugin-onepassword
@executor/plugin-openapi
@executor/plugin-workos-vault
executor
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
$refwalker with@readme/openapi-parser6.x (samejson-schema-ref-parsercore as@apidevtools/swagger-parser, but with a proper dual ESM/CJSexportsmap — friction-free in bundlers and Workers).parse.tsnow callsdereference(api, { resolve: { external: false }, dereference: { circular: true } })after the JSON/YAML decode + 3.x version gate.$refs are deliberately not resolved (Workers-safe) and broken internal pointers surface asOpenApiParseError.openapi-utils.tsDocResolvercollapses to a thin identity passthrough — the public API is preserved but there's no pointer walking left.Why
The hand-written resolver didn't handle transitive cycles (mutual recursion,
allOfcycles) and had a few bugs around array-indexed pointers on real-world specs. Moving to the upstream parser means we follow the spec (RFC 6901 JSON Pointer, OpenAPI 3.x rules) by default.Test plan
bunx vitest runinpackages/plugins/openapi— 47/47 passcircular-ref.test.ts(new) — 4 tests covering self-cycle, mutual recursion, extract-over-cycles, identity preservationmalformed-spec.test.ts(new) — 7 tests for empty/garbage input, Swagger 2.x rejection, broken$ref, tagged-error matchingbunx tsc --noEmitclean