JSON Schema definitions and examples for Kosmos data formats
Go to file
2022-04-27 15:50:16 +02:00
.github Add release-drafter config 2020-05-13 17:01:52 +02:00
examples Initial expense schema 2020-05-06 11:24:02 +02:00
schemas Use CommonJS for schema files 2020-06-27 16:19:03 +02:00
.gitignore Support browserification of module 2017-06-05 20:14:38 +02:00
.jshintrc Add JSHint config 2017-06-05 16:00:07 +02:00
index.js Use CommonJS for schema files 2020-06-27 16:19:03 +02:00
package-lock.json 3.1.0 2022-04-27 15:50:16 +02:00
package.json 3.1.0 2022-04-27 15:50:16 +02:00
README.md Add npm link/version to README 2020-05-16 13:11:50 +02:00

npm

This repository/module contains JSON Schema definitions as well as examples for Kosmos data formats.

Usage

You can import these schemas to validate data in JavaScript programs. For example using npm and the tv4 JSON Schema validator:

let tv4 = require('tv4');
let schemas = require('kosmos-schemas');

let contributor = {
  name: "Tyrion"
}

let result = tv4.validate(contributor, schemas['contributor']);

if (result) {
  console.log('Your data is valid');
} else {
  console.log('Your data is not valid:');
  console.log(tv4.error);
}