genson-js
genson-js copied to clipboard
feat: option noAdditionalProperties
Adding option noAdditionalProperties
Add additionalProperties=false
to all object types
import { createSchema } from 'genson-js';
const schema = createSchema({ one: 1, two: 'second' }, { noAdditionalProperties: true });
The following schema will be created:
{
type: 'object',
additionalProperties: false,
properties: { one: { type: 'integer' }, two: { type: 'string' } },
required: [
"one",
"two",
]
}