Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallowed additional properties are not checked #315

Open
javagl opened this issue Oct 16, 2024 · 0 comments
Open

Disallowed additional properties are not checked #315

javagl opened this issue Oct 16, 2024 · 0 comments

Comments

@javagl
Copy link
Contributor

javagl commented Oct 16, 2024

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant