You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following rule that is asking my designers to add examples for query params:
description: All query parameters SHOULD have an example.
severity: error
message: 'All query parameters SHOULD have an example.'
given: "$..parameters[?(@.in == 'query')]"
then:
field: example
function: truthy
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:
parameters:
- name: employeeId
description: A filter to include one or more employees' absences. A maximum of 20 employees' absences can be requested. The absences are grouped by employee.
required: false
in: query
schema:
type: string
style: form
explode: false
examples:
oneId:
value: A1234
multipleIds:
value: A12134,A13,M12334
Is this something you have thought of as a good rule?
The text was updated successfully, but these errors were encountered:
Hey!
Unfortunately, Spectral does not support OR just yet. We have a pending feature request that can be found here stoplightio/spectral#1276.
For the time being, you will need to write a custom function.
An example function for your use case could look as follows
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?
The text was updated successfully, but these errors were encountered: