From ccd1a281679713612374c0c8b176a48ee20f0191 Mon Sep 17 00:00:00 2001 From: "Jarzyna, Andrzej" Date: Wed, 20 Nov 2019 16:11:12 +0100 Subject: [PATCH] Add oas2 check for example or ref existance in a body parameter --- .spectral.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.spectral.yml b/.spectral.yml index ab7bbd3..5faaf57 100644 --- a/.spectral.yml +++ b/.spectral.yml @@ -98,16 +98,16 @@ rules: type: string enum: - application/json - # example-exists-in-parameters: - # description: All models MUST have a valid example. - # severity: error - # recommended: true - # formats: - # - oas2 - # message: "{{ property }} MUST have a valid example." - # given: "$..parameters..[?(@.in == 'body')]..[?( !@.example || !@.schema.$ref)]" - # then: - # function: falsy + example-exists-in-parameters: + description: All models MUST have a valid example. + severity: error + recommended: true + formats: + - oas2 + message: "{{ property }} MUST have a valid example." + given: "$..parameters..[?(@.in == 'body' && (@.example || @.schema.$ref))]" + then: + function: truthy # example-exists-in-definitions: # description: All models MUST have a valid example. # severity: error