Closed savage-alex closed 3 years ago
Hey! Unfortunately, Spectral does not support OR just yet. We have a pending feature request that can be found here https://github.com/stoplightio/spectral/issues/1276. For the time being, you will need to write a custom function.
An example function for your use case could look as follows
module.exports = function (targetVal) {
if (!targetVal.example && !targetVal.examples) {
return { message: 'some message' };
}
};
For more info regarding the usage of custom functions please refer to docs
Duplicate as discussed above.
Thanks @P0lip !
I have the following rule that is asking my designers to add examples for query params:
I would also like it to accept when a designer has included "examples" as well (Hopefully through an OR field+truthy)
OAS syntax for multiple examples:
Is this something you have thought of as a good rule?