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

Support OR combinator #1276

Open
XVincentX opened this issue Jul 8, 2020 · 2 comments
Open

Support OR combinator #1276

XVincentX opened this issue Jul 8, 2020 · 2 comments
Labels
enhancement New feature or request triaged

Comments

@XVincentX
Copy link
Contributor

It would be very helpful if Spectral could support some sort of OR combinator where I can define multiple functions to apply. If one of them passes, the validation is marked as ✅

  given: >-
      $...parameters[*].name
  then:
    or:
    - function: casing
      functionOptions:
        type: snake
    - function: casing
      functionOptions:
        type: camel
@ioggstream
Copy link

ioggstream commented Jul 8, 2020

Probably a general thought on other logic functions could be useful (eg. negating function, negating then). Such a mechanism allows to implement or like that:

then_not:
- function: casing
  expect: false
  functionOptions: {type: snake}
- ...

via De Morgan.

@philsturgeon
Copy link
Contributor

We talked about having a "not" today, which is probably related to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triaged
Projects
None yet
Development

No branches or pull requests

5 participants