Recursively parse OpenAPI specifications such that all

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-12-01 01:00:02

Recursively parse OpenAPI specifications such that all "$ref": "#/foo" entries are replaced with what the reference in the spec resolves to.

Our goal is to make it easier to load an OpenAPI schema into a search index or tool calling repository for RAG-style LLM usecases. This is a very simple package which wraps @json-schema-tools/reference-resolver. You may want to consider copying the index.ts function intead of installing this entire package.

Phil Sturgeon published Only You Can Bring Modern OpenAPI Bundling to JavaScript in October of 2022, and this is us tip-toe'ing into doing that. We tried using the canonical json-schema-ref-parser, but it's continueOnError feature is deeply broken and was not simple to fix.

OpenAPI specs have gotten more valuable in the past couple years of LLMs being around since LLMs are able to intelligently do things once they know about every route available in a given API. However, they can be hard to process into a search index or tool calling repository because they leverage a $ref system.

Leave a Comment