Add README
This commit is contained in:
parent
9e8b070489
commit
007a9371e7
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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](https://www.npmjs.com/package/tv4) JSON Schema
|
||||||
|
validator:
|
||||||
|
|
||||||
|
```js
|
||||||
|
let tv4 = require('tv4');
|
||||||
|
let schemas = require('kosmos-schemas');
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* Add script for publishing both human- and machine-readable schemas to
|
||||||
|
https://schemas.kosmos.org
|
Loading…
x
Reference in New Issue
Block a user