![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
openapi-schema-ref-parser
Advanced tools
This package recursively parses OpenAPI specifications such that all `"$ref": "#/foo"` entries are replaced with what the reference in the spec resolves to.
This package recursively parses 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.
npm install openapi-schema-ref-parser
import expandRefs from "openapi-schema-ref-parser";
async function expandOpenapiSpec() {
const specResponse = await fetch(
"https://api.trieve.ai/api-docs/openapi.json"
);
const specText = await specResponse.text();
const openapiSpec = JSON.parse(specText);
// Expand all $ref pointers within the OpenAPI document
const expandedSpec = await expandRefs(openapiSpec, { maxDepth: 1000 });
// Process each route in the specification
for (const path in expandedSpec.paths) {
for (const method in expandedSpec.paths[path]) {
const methodPath = `${method.toUpperCase()} ${path}`;
const route = { [methodPath]: expandedSpec.paths[path][method] };
// Instead of logging, you might want to:
// - Add to a search index like Trieve.ai
// - Update a tool repository
console.log(JSON.stringify(route, null, 2));
}
}
}
expandOpenapiSpec();
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.
OpenAPI specifications tend to re-use types across many path
's and method
's. To simplify their defitions, the final JSON
or YAML
files contain several field values like {"schema": { "$ref": "#/components/schemas/ErrorResponseBody" }}
where the actual value lies at openapiSpec.components.schemas.ErrorResponseBody
.
FAQs
Recursively parse OpenAPI specifications such that all `"$ref": "#/foo"` entries are replaced with what the reference in the spec resolves to.
The npm package openapi-schema-ref-parser receives a total of 2 weekly downloads. As such, openapi-schema-ref-parser popularity was classified as not popular.
We found that openapi-schema-ref-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.