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

Conditional requires in arrays of objects #92

Open
psvet opened this issue Feb 4, 2020 · 0 comments
Open

Conditional requires in arrays of objects #92

psvet opened this issue Feb 4, 2020 · 0 comments

Comments

@psvet
Copy link
Owner

psvet commented Feb 4, 2020

const model = obey.model({
  list: {
    type: 'array',
    values: {
      type: 'object',
      keys: {
        someQualifier: {
          type: 'string',
          allow: [ 'a', 'b', 'c' ]
        },
        someDependentProp: {
          type: 'string',
          requiredIfNot: { 'list[thisIndex].someQualifier': 'b' } // This won't work
        }
      }
    }
  }
})
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

1 participant