@trojs/openapi-dereference
v1.0.0
Published
OpenAPI dereference
Downloads
1,400
Readme
OpenAPI dereference
Dereference $ref pointers in JSONSchema or OpenAPI documents.
Zero dependencies. Synchronous core. Handles circular refs.
Installation
npm install @trojs/openapi-dereference
or
yarn add @trojs/openapi-dereference
Test the package
npm run test
or
yarn test
How to use
npm i @trojs/openapi-dereference
import { dereferenceSync } from '@trojs/openapi-dereference';
const schemaWithRefs = {
schemas: {
Person: {
type: 'object',
properties: {
name: {
$ref: '#/schemas/Name',
},
},
},
Name: {
type: 'string',
},
},
};
const schemaWithNoRefs = dereferenceSync(schemaWithRefs);