1.2.2 • Published 4 years ago

@stoplight/json-ref-readers v1.2.2

Weekly downloads
38,323
License
Apache-2.0
Repository
github
Last release
4 years ago

json-ref-readers

Set of utilities for reading external json references.

Installation

yarn add @stoplight/json-ref-readers

Usage

The library exports two functions: resolveHttp and resolveFile. Both take uri.URI and resolve to a string containing requested resource.

import { Resolver } from '@stoplight/json-ref-resolver';
import { resolveFile, resolveHttp } from '@stoplight/json-ref-readers';

const httpAndFileResolver = new Resolver({
  resolvers: {
    https: { resolve: resolveHttp },
    http: { resolve: resolveHttp },
    file: { resolve: resolveFile },
  },
});