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

@readme/json-schema-ref-parser

Package Overview
Dependencies
Maintainers
10
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@readme/json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers

  • 1.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
252K
decreased by-4.28%
Maintainers
10
Weekly downloads
 
Created

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

@readme/json-schema-ref-parser is a powerful library for parsing, resolving, and dereferencing JSON Schema $ref pointers. It allows you to work with complex JSON schemas that contain references to other schemas, making it easier to manage and validate large and interconnected JSON data structures.

What are @readme/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('@readme/json-schema-ref-parser');

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

parseSchema();

Resolving JSON Schema References

This feature resolves all $ref pointers in the JSON schema, replacing them with the actual referenced values. This is useful for working with schemas that reference other schemas.

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

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

resolveSchema();

Dereferencing JSON Schema

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

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

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

 dereferenceSchema();

Bundling JSON Schema

This feature bundles all referenced schemas into a single schema. This is useful for creating a standalone schema that contains all the necessary definitions.

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

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

bundleSchema();

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

Keywords

FAQs

Package last updated on 24 Oct 2023

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