Stoplight Spectral - using logical OR in rules via function

216 views Asked by At

I want to achieve, that a rule fulfills two conditions connected with an or. I defined these conditions as functions.

How do I achieve this?

I tried to "import" the two functions into a third function which i then referenced in the rule, but js wont allow the import without defining a module

Cannot use import statement outside a module

which spectral doesnt like... (after setting <script type="module"> )

Unexpected token '<'

When i "require" the two functions "require" is not defined.

require is not defined
1

There are 1 answers

0
agruenth On

The issue was my spectral installation - after an update the "require" worked for me like expected.

Version working for me is: Spectral: 5.6.0 Node: v14.13.0