Schematized
Turn JS objects into JSON schemas that continue to improve as you provide examples.
A Node port of the Python module Genson.
:rocket: Quickstart
- Add dependency
yarn add schematized
- Basic usage
import { SchemaBuilder } from 'schematized'
const { default: SchemaBuilder } = require('schematized')
const builder = new SchemaBuilder()
builder.addObject({
token: '74aea1a53d68b77e4f1f55fa90a7eb81',
role: ['Basic'],
})
const schema = builder.toSchema()
- Improve the schema
...
builder.addObject({
token: 'Bearer 6498d9afc96d1d8d881a2b7ded4f9290',
role: [
'Admin',
'Basic',
'Publisher'
]
})
builder.addSchema(savedSchema)
Schema from the single example:
Schema from the two examples:
Schema from the two examples and the previously saved schema: