@OADA/formats
This package is a library for using OADA/formats with JavaScript/TypeScript. It
is mainly an Ajv instance pre-packaged with the OADA schemas.
Installation
yarn add @oada/formats
Usage
This TypeScript/JavaScript library exports an async function that resolves to an
Ajv instance which is loaded with all the schemas from this project.
import loadAllFormats from '@oada/formats';
const obj = {
};
const formats = await loadAllFormats();
formats.validate('https://formats.openag.io/oada/bookmarks.schema', obj);
In addition to being loaded with all the OADA formats, the returned Ajv
instance is also augmented to be able to resolve content types to the relevant
schema.
const { schema } = formats.getSchema('applications/vnd.oada.bookmarks.1+json');