Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@colophon/schema

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@colophon/schema

Schema & Validator for https://colophon.id

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Colophon Schema

License version Build Status

Schema & Validator for Colophon

Schema Specification

Versions

#status
2.0stable
1.1deprecated
1.0deprecated

see an example of this repo's own .colophon.yml...

Install

Available as an npm package for validation purposes, exposes validation helper, and the schema itself (compatible with any JSON Schema validation tool)

npm install @colophon/schema

Usage

const parser = require('@colophon/schema')
const { schema, regex } = require('@colophon/schema/versions/latest')

Referencing older versions

const schemas = require('@colophon/schema/versions')

const { schema, regex } = schemas['1.0']

API

parser(colophon: String | Object): Promise<Object>

Resolves with content as a valid JavaScript Colophon Object Rejects with ColophonError on invalid schema test

Example: Valid Colophon
const parser = require('@colophon/schema')

const valid = { ... } // supply an Object or YAML String

const colophon = await parser(valid)
// colophon is a JavaScript Object (parsed from YAML string, or returned as is)
Example: Invalid Colophon
const parser = require('@colophon/schema')

// invalid
const invalid = `
version: 2.0

id: my-app
`

parser(invalid)
  .then(colophon)
  .catch(err => console.error(err.message, err.errors))
    // invalid colophon content
    // "err.errors" object contains schema errors
    // e.g. "err.errors": [ { message: "should have required property 'contacts'" } ]
    // see https://github.com/epoberezkin/ajv#validation-errors for details
}

Credits


Author: Ahmad Nassri • Github: @project-colophon • Twitter: @ColophonID

Keywords

FAQs

Package last updated on 07 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc