mirror of
https://github.com/adidas/api-guidelines.git
synced 2025-10-25 15:19:19 +00:00
WiP oas2 example existence
This commit is contained in:
@@ -43,32 +43,6 @@ rules:
|
||||
function: pattern
|
||||
functionOptions:
|
||||
notMatch: "/^body$/"
|
||||
response-success-hal: # schemes and/or produces
|
||||
description: All success responses MUST be of media type `application/hal+json`
|
||||
severity: error
|
||||
given: $.paths..responses[?( @property >= 200 && @property < 300 && @property != 204)]
|
||||
recommended: true
|
||||
type: "style"
|
||||
message: "Response documents MUST follow application/hal+json: {{error}}"
|
||||
then:
|
||||
field: schema
|
||||
function: schema
|
||||
functionOptions:
|
||||
schema:
|
||||
$ref: ./supermodel/adidas/api/HAL.yaml
|
||||
response-error-problem: # schemes and/or produces
|
||||
description: All error responses MUST be of media type `application/problem+json`
|
||||
severity: error
|
||||
given: $.paths..responses[?( @property >= 400 && @property < 600 )]
|
||||
recommended: true
|
||||
type: "style"
|
||||
message: "Error response document MUST follow application/problem+json: {{error}}"
|
||||
then:
|
||||
field: schema.example
|
||||
function: schema
|
||||
functionOptions:
|
||||
schema:
|
||||
$ref: ./supermodel/adidas/api/ProblemDetail.yaml
|
||||
uri-template-cannot-dash:
|
||||
description: The `URI` template ([RFC 6570](https://tools.ietf.org/html/rfc6570)) cannot contain a `-` character
|
||||
severity: error
|
||||
@@ -119,7 +93,47 @@ rules:
|
||||
type: string
|
||||
enum:
|
||||
- application/json
|
||||
# valid-example-in-definitions: has to be turned off for oas2 but not for oas3
|
||||
# valid-example-in-definitions: has to be turned off for oas2 but not for oas3
|
||||
example-exists:
|
||||
description: All models MUST have a valid example.
|
||||
severity: error
|
||||
recommended: true
|
||||
formats:
|
||||
- oas2
|
||||
message: "{{ property }} MUST have a valid example."
|
||||
given: $.definitions[?(!@.example)]
|
||||
then:
|
||||
function: falsy
|
||||
response-success-hal: # schemes and/or produces
|
||||
description: All success responses MUST be of media type `application/hal+json`
|
||||
severity: error
|
||||
given: $.paths..responses[?( @property >= 200 && @property < 300 && @property != 204)]
|
||||
recommended: true
|
||||
type: "style"
|
||||
formats:
|
||||
- oas2
|
||||
message: "Response documents MUST follow application/hal+json: {{error}}"
|
||||
then:
|
||||
field: schema
|
||||
function: schema
|
||||
functionOptions:
|
||||
schema:
|
||||
$ref: ./supermodel/adidas/api/HAL.yaml
|
||||
response-error-problem: # schemes and/or produces
|
||||
description: All error responses MUST be of media type `application/problem+json`
|
||||
severity: error
|
||||
formats:
|
||||
- oas2
|
||||
given: $.paths..responses[?( @property >= 400 && @property < 600 )]
|
||||
recommended: true
|
||||
type: "style"
|
||||
message: "Error response document MUST follow application/problem+json: {{error}}"
|
||||
then:
|
||||
field: schema.example
|
||||
function: schema
|
||||
functionOptions:
|
||||
schema:
|
||||
$ref: ./supermodel/adidas/api/ProblemDetail.yaml
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Only OAS3 rules
|
||||
@@ -128,10 +142,10 @@ rules:
|
||||
# description: Every request SHOULD support `application/json` media type
|
||||
# formats:
|
||||
# - oas3
|
||||
# recommended: truex
|
||||
# recommended: true
|
||||
# severity: error
|
||||
# message:
|
||||
# given: $.
|
||||
# given: $.requestBody..content
|
||||
# then:
|
||||
# function: pattern
|
||||
# functionOptions:
|
||||
@@ -148,6 +162,8 @@ rules:
|
||||
function: pattern
|
||||
functionOptions:
|
||||
match: "/^https:[a-zA-Z0-9./_@-~]+/"
|
||||
# response-success-hal-oas3:
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Not implemented
|
||||
|
||||
Reference in New Issue
Block a user