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

feat: option noAdditionalProperties - #39

Open
alanblins wants to merge 1 commit into
aspecto-io:masterfrom
alanblins:optionNoAdditionalProperties
Open

alanblins wants to merge 1 commit into
aspecto-io:masterfrom
alanblins:optionNoAdditionalProperties

Conversation

@alanblins

Copy link
Copy Markdown

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