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

Rule names conflict with schema-attribute names #15

Closed
willrstern opened this issue Apr 8, 2015 · 2 comments
Closed

Rule names conflict with schema-attribute names #15

willrstern opened this issue Apr 8, 2015 · 2 comments
Assignees
Labels

Comments

@willrstern
Copy link
Contributor

A schema-attribute named email will error if there is a rule named email

schemator.defineRule('email', function (x) {
  return null;
});

var schema = schemator.defineSchema('mySchema', {
  //this schema errors because field "email" matches a rule name
  email: {
    email: true
  }
});

This prevents from using on data structures with attributes such as "type", "max", or any custom rule.

It's happening here...
https://github.com/js-data/js-data-schema/blob/master/lib/schema.js#L225

@jmdobry
Copy link
Member

jmdobry commented Apr 8, 2015

Yeah, I had been thinking about simply deleting that line of code. And the tests pass without it, so I'll do it shortly.

@jmdobry jmdobry added the bug label Apr 8, 2015
@jmdobry jmdobry self-assigned this Apr 8, 2015
@willrstern
Copy link
Contributor Author

Oh nice. I was gonna submit a pr with it out (I noticed the passing tests as well), but wasn't sure why it was in place.

Thanks again!

@jmdobry jmdobry closed this as completed in 7214011 Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants