Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/json-schema-ref-parser

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers

  • 10.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @stoplight/json-schema-ref-parser?

@stoplight/json-schema-ref-parser is a powerful library for parsing, resolving, and dereferencing JSON Schema $ref pointers. It helps in managing complex JSON schemas by resolving references to external files, URLs, or internal schema definitions.

What are @stoplight/json-schema-ref-parser's main functionalities?

Parsing JSON Schema

This feature allows you to parse a JSON Schema from a file or URL. The parsed schema is returned as a JavaScript object.

const $RefParser = require('@stoplight/json-schema-ref-parser');

async function parseSchema() {
  const schema = await $RefParser.parse('path/to/your/schema.json');
  console.log(schema);
}

parseSchema();

Resolving References

This feature resolves all $ref pointers in the JSON Schema, returning a detailed object that includes the resolved references.

const $RefParser = require('@stoplight/json-schema-ref-parser');

async function resolveSchema() {
  const schema = await $RefParser.resolve('path/to/your/schema.json');
  console.log(schema);
}

resolveSchema();

Dereferencing

This feature dereferences all $ref pointers in the JSON Schema, replacing them with the actual referenced values. The result is a fully dereferenced schema.

const $RefParser = require('@stoplight/json-schema-ref-parser');

async function dereferenceSchema() {
  const schema = await $RefParser.dereference('path/to/your/schema.json');
  console.log(schema);
}

dereferenceSchema();

Other packages similar to @stoplight/json-schema-ref-parser

Keywords

FAQs

Package last updated on 18 Mar 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc