Add az-request-body-type rule.

This commit is contained in:
Mike Kistler 2023-04-02 09:52:48 -05:00
Родитель a6c446c3d4
Коммит 33d465842d
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -255,6 +255,10 @@ RFC7231 states that the payload for both get and delete "has no defined semantic
Flag a body parameter/request body that is not marked as required. This is a common oversight.
### az-request-body-type
Request body schema must not be a bare array.
### az-response-body-type
Response body schema must not be a bare array.

Просмотреть файл

@ -547,6 +547,18 @@ rules:
field: required
function: truthy
az-request-body-type:
description: Request body schema must not be a bare array.
severity: warn
formats: ['oas2']
given:
- $.paths[*].[put,post,patch].parameters.[?(@.in == 'body')].schema
then:
field: type
function: pattern
functionOptions:
notMatch: '/^array$/'
az-response-body-type:
description: Response body schema must not be a bare array.
severity: warn