Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tuckerconnelly/validate
https://github.com/tuckerconnelly/validate
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tuckerconnelly/validate
- Owner: tuckerconnelly
- License: mit
- Created: 2020-05-08T20:20:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T05:21:29.000Z (almost 2 years ago)
- Last Synced: 2024-11-22T22:36:05.472Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 874 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
***Early Version***
# validate
Validates json schemas and outputs [json-api error objects](https://jsonapi.org/format/#error-objects).
## Usage
```
npm i @tuckerconnelly/validate
``````js
const validate = require('@tuckerconnelly/validate');try {
validate(
{
properties: {
title: 'id',
id: { type: integer }
}
},
{ notId: 'A string' }
)
} catch (err) {
console.error(err.errors);// [
// {
// title: 'Expected id to be a string.'
// source: '/id'
// }
// ]
}
```## License
MIT