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

Schema validation #121

Open
EugeneKostrikov opened this issue Mar 6, 2015 · 1 comment
Open

Schema validation #121

EugeneKostrikov opened this issue Mar 6, 2015 · 1 comment
Labels

Comments

@EugeneKostrikov
Copy link

There's nothing to warn about misconfiguration and typos. One of the most annoying examples - wrong reference name that doesn't show up until you try to create compound resource.

app.resource('user', {
  addresses: [{ref: 'addresses'}]  //This will throw an error as there's no 'addresses' resource
});
app.resource('address', {
   user: {ref: 'user'}
});
@EugeneKostrikov
Copy link
Author

One other thing to validate is when some reference field is used by two "inverse" fields.

app.resource('user', {
  addresses: [{ref: 'address', inverse: 'user'}],
  estate: [{ref: 'address', inverse: 'user'}]
});

app.resource('address', {
   user: {ref: 'user', inverse: 'addresses'}
})

The same applies to the case when single reference is used from two different resources:

app.resource('user', {
  address: {ref: 'address', inverse: 'user'}
});
app.resource('address', {
  user: {ref: 'address' inverse: 'address'}
});
app.resource('pet', {
  user: {ref: 'user', inverse: 'address'}
})

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

1 participant