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

Unique together #5

Open
jsbUSMC opened this issue Aug 14, 2017 · 3 comments
Open

Unique together #5

jsbUSMC opened this issue Aug 14, 2017 · 3 comments

Comments

@jsbUSMC
Copy link

jsbUSMC commented Aug 14, 2017

It seems that this plugin ensures that values from the fields specified are each unique on the table. How would I go about using this plugin to ensure that the values of my fields are unique together in the table, but each is not forced to be unique on its own? Thank you for your help, and thank you for the work you've put in on this plugin!

@joaonice
Copy link
Member

@jsbUSMC,

right now we are checking each field individually. Maybe we could add an option compositeFields and if set to true, we check all the fields together.

Right now the error data is something like:

  {
    "field1": [{
       "keyword": "unique",
       "message": "field1 already in use."
     }],
    "field2": [{
       "keyword": "unique",
       "message": "field2 already in use."
     }]
  }

In this case (with composite fields) maybe we should return something like this:

  {
    "field1+field2": [{
       "keyword": "unique",
       "message": "field1 and field2 already in use."
     }]
  }

Or continue to return each field separately.

What do you think?

@jsbUSMC
Copy link
Author

jsbUSMC commented Sep 17, 2017

Sorry I must have missed this notification! I think that what you've proposed would be great.

@nunorafaelrocha
Copy link
Collaborator

@jsbUSMC accepting contributions! All pull requests are welcome 😄

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

3 participants