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

Relationship validation #34

Open
dclucas opened this issue Dec 21, 2015 · 4 comments
Open

Relationship validation #34

dclucas opened this issue Dec 21, 2015 · 4 comments

Comments

@dclucas
Copy link
Contributor

dclucas commented Dec 21, 2015

(disclaimer: maybe we want to split this in more than one issue. I'd get started with 'required' validations).

When describing an entity with a relationship (eg: a product has a brand), we need a way to say that relationship is mandatory (eg: a product must have a link to a brand).

@kristofsajdak
Copy link
Contributor

Currently we already have a more extended format for relationships in case they reference a remote API

e.g.

{
       type: 'posts',
       attributes: {},
       relationships: {
            author: {type: 'people', baseUri: 'http://localhost:9999'},
            comments: ['comments'],
            topic: 'topics'
       }
}

How about we extend that with a required attribute?

{
       type: 'posts',
       attributes: {},
       relationships: {
            author: {type: 'people', baseUri: 'http://localhost:9999', required: false},
            comments: ['comments'],
            topic: 'topics'
       }
}

Not sure whether we want to default to 'false' or 'true' here, perhaps we could make that configurable at the plugin level?

@dclucas
Copy link
Contributor Author

dclucas commented Dec 24, 2015

Sounds like a good plan to me. I would assume 'required' as false by default...

@kristofsajdak
Copy link
Contributor

Hey Diogo, perhaps you could submit a PR for this? Would be nice to get you in as a committer

@dclucas
Copy link
Contributor Author

dclucas commented Jan 8, 2016

resisting... the urge... not to jump in that code.

ok, I will have a look. but please don't wait on me for this one -- I might be too swamped to be able to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants