Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Conversation

alanblins
Copy link

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",
    ]
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant