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

Empty objectKeys with nested schemas #12

Closed
radekmie opened this issue Sep 24, 2016 · 3 comments
Closed

Empty objectKeys with nested schemas #12

radekmie opened this issue Sep 24, 2016 · 3 comments

Comments

@radekmie
Copy link

radekmie commented Sep 24, 2016

Hey!

During integration between uniforms (React forms package) and SimpleSchema2 (vazco/uniforms#99), I've found this bug.

// I'm using the explicit notation, so it work also with the previous version
const schemaA = new SimpleSchema({a: {type: new SimpleSchema({b: {type: new SimpleSchema({c: {type: String}})}})}});
const schemaB = new SimpleSchema({a: {type: Object}, 'a.b': {type: Object}, 'a.b.c': {type: String}});

// SimpleSchema
console.log(schemaA.objectKeys('a')); // ['b']
console.log(schemaB.objectKeys('a')); // ['b']
console.log(schemaA.objectKeys('a.b')); // ['c']
console.log(schemaB.objectKeys('a.b')); // ['c']

// SimpleSchema2
console.log(schemaA.objectKeys('a')); // []
console.log(schemaB.objectKeys('a')); // ['b']
console.log(schemaA.objectKeys('a.b')); // []
console.log(schemaB.objectKeys('a.b')); // ['c']

// SimpleSchema2 - expected output
console.log(schemaA.objectKeys('a')); // ['b']
console.log(schemaB.objectKeys('a')); // ['b']
console.log(schemaA.objectKeys('a.b')); // ['c']
console.log(schemaB.objectKeys('a.b')); // ['c']
@clayne11
Copy link
Collaborator

I think this might be fixed with #31. Please see https://github.com/clayne11/node-simple-schema. Create an issue on the new repo if there's still an problem.

@radekmie
Copy link
Author

I'll give it a try after the Christmas, @clayne11.

@aldeed
Copy link
Collaborator

aldeed commented Dec 27, 2016

Released a fix for this in 0.0.4

@aldeed aldeed closed this as completed Dec 27, 2016
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

3 participants