Wondering what’s next for npm?Check out our public roadmap! »

    @oada/formats
    TypeScript icon, indicating that this package has built-in type declarations

    1.5.1 • Public • Published

    @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 the schemas from this project.

    import loadAllFormats from '@oada/formats';
    
    const obj = {
      /* Properties and stuff here */
    };
    
    const formats = await loadAllFormats();
    
    // Check that obj matches the format for and OADA bookmarks document
    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.

    // Returns the schema for an OADA Bookmarks document
    const { schema } = formats.getSchema('applications/vnd.oada.bookmarks.1+json');

    Install

    npm i @oada/formats

    DownloadsWeekly Downloads

    10

    Version

    1.5.1

    License

    MIT

    Unpacked Size

    2.51 MB

    Total Files

    366

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar