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

Why does FromSchema on an object schema allow any properties [x: string]: unknown on the type? #205

Closed
aentwist opened this issue Jul 3, 2024 · 2 comments

Comments

@aentwist
Copy link

aentwist commented Jul 3, 2024

This goes against TS, I'd prefer objects of known and well-defined types to not accept additional fields that don't exist. If I wanted a subtype I'd explicitly declare it. What was the design choice with this?

@ThomasAribart
Copy link
Owner

@aentwist Yes, this is a design choice. This reminds you that JSON Schemas do not deny additional properties by default.

You can remove it by using additionalProperties: false, or unevaluatedProperties: false.

@aentwist
Copy link
Author

aentwist commented Jul 9, 2024

Thank you for the fantastic answer. I appreciate it.

@aentwist aentwist closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
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

2 participants