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

How to validate only given properties exist? #42

Open
trusktr opened this issue Jul 17, 2015 · 1 comment
Open

How to validate only given properties exist? #42

trusktr opened this issue Jul 17, 2015 · 1 comment

Comments

@trusktr
Copy link

trusktr commented Jul 17, 2015

How do we specify that any fields other than the ones specified are not allowed? SO, f.e., I want this:

var Thing = schema({
  foo: Number
})

Thing({foo: 5}) // true
Thing({foo: 5, bar: "blah"}) // false, because `blah` isn't a specified property.
@matsuki820
Copy link

This might be way to late for an answer, but I found myself looking for the same answer and ended up using something like this:
Thing:{ "*":Object.like(undefined), foo:5 }

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