Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dereference-json-schema

anttiviljami418.8kMIT0.2.1TypeScript support: included

Dereference $ref pointers in JSONSchema or OpenAPI documents.

dereference, json-schema, openapi, swagger

readme

dereference-json-schema

CI npm version npm downloads bundle size License Buy me a coffee

Dereference $ref pointers in JSONSchema or OpenAPI documents.

Zero dependencies. Synchronous core. Handles circular refs.

Usage

npm i dereference-json-schema
import { dereferenceSync } from 'dereference-json-schema';

const schemaWithRefs = {
  schemas: {
    Person: {
      type: 'object',
      properties: {
        name: {
          $ref: '#/schemas/Name',
        },
      },
    },
    Name: {
      type: 'string',
    },
  },
};

const schemaWithNoRefs = dereferenceSync(schemaWithRefs);

Contributing

dereference-json-schema is Free and Open Source Software. Issues and pull requests are more than welcome!