Skip to content

Disallowed additional properties are not checked #315

@javagl

Description

@javagl

The JSON schema can explicitly disallow properties that are not listed in the properties, by saying
additionalProperties: false

Right now, the validator does not check this.

Doing this could be simple on a technical level: There could be a convenience function like

ensurePropertiesAreOnly(object, ["exampleProperty", "otherProperty", "yetAnotherProperty" ]);

that simply iterates over all properties of the object, and checks that each one appears in the given array.

But listing all these "allowed" properties explicitly (for each and every type) could be cumbersome (so much that I'm not sure whether it's worth the effort). But we could consider such a check, even though it might involve a bit of manual work to list the allowed properties for each structure...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions