Add oas2 check for example or ref existance in a body parameter

This commit is contained in:
Jarzyna, Andrzej
2019-11-20 16:11:12 +01:00
parent a9549b2c3a
commit ccd1a28167

View File

@@ -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