https://github.com/stoplightio/json-ref-readers
Paired with a resolver package, readers handle the loading of $ref content. This repo contains some common readers for files, URLs, etc.
https://github.com/stoplightio/json-ref-readers
Last synced: about 1 year ago
JSON representation
Paired with a resolver package, readers handle the loading of $ref content. This repo contains some common readers for files, URLs, etc.
- Host: GitHub
- URL: https://github.com/stoplightio/json-ref-readers
- Owner: stoplightio
- License: apache-2.0
- Created: 2019-10-09T09:14:29.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-23T09:59:33.000Z (over 1 year ago)
- Last Synced: 2025-04-05T12:47:13.281Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@stoplight/json-ref-readers
- Size: 1.25 MB
- Stars: 2
- Watchers: 16
- Forks: 3
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# json-ref-readers
Set of utilities for reading external json references.
## Installation
```bash
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.
```ts
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 },
},
});
```