https://github.com/marcodpt/json-schema
My own approach on json-schmea
https://github.com/marcodpt/json-schema
Last synced: 12 months ago
JSON representation
My own approach on json-schmea
- Host: GitHub
- URL: https://github.com/marcodpt/json-schema
- Owner: marcodpt
- License: mit
- Created: 2022-04-16T13:41:41.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-03T14:37:51.000Z (almost 4 years ago)
- Last Synced: 2025-01-13T15:27:54.035Z (about 1 year ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json-schema
My own approach on json-schmea
## Clone tests
```
git clone https://github.com/json-schema-org/JSON-Schema-Test-Suite.git
```
## Usage
```
import validator from 'https://cdn.jsdelivr.net/gh/marcodpt/json-schema/index.js'
const v = validator({
type: "object",
properties: {
foo: {
type: "string"
},
bar: {
type: "integer"
}
}
})
console.log(v({}))
//true
console.log(v({foo: "foo"}))
//true
console.log(v({foo: 3}))
//false
console.log(v({bar: 3}))
//true
console.log(v({bar: "bar"}))
//false
console.log(v({
foo: "foo",
bar: 3
}))
//true
```
## TODO
- build tests script
- pass all json schema spec
- deno tests
- error handler