-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path0132.yaml
More file actions
117 lines (112 loc) · 3.41 KB
/
0132.yaml
File metadata and controls
117 lines (112 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
aliases:
ListOperation:
description: A list operation is a get on path that does not end in a path parameter
targets:
- formats: ['oas2', 'oas3']
given:
# first condition excludes custom methods and second condition excludes paths ending in a path parameter
- $.paths[?(!@property.match(/:[^/]*$/) && !@property.match(/\}$/))].get
functionsDir: ../functions
functions:
- skipSingletonsSchema
- get-no-request-body
rules:
aep-132-http-body:
description: A list operation must not accept a request body.
message: '{{error}}'
severity: error
formats: ['oas3']
given:
- $.paths[*]
then:
function: get-no-request-body
aep-132-operation-id:
description: The operation ID should be List{resource-singular}.
message: The operation ID does not conform to AEP-132
severity: error
formats: ['oas2', 'oas3']
given: '#ListOperation'
then:
function: skipSingletonsSchema
functionOptions:
schema:
type: object
properties:
operationId:
type: string
pattern: '^[Ll][Ii][Ss][Tt][A-Z].*$'
required: ['operationId']
aep-132-param-types:
description: List operation must use the correct type for any optional parameters.
severity: error
formats: ['oas3']
given:
- '#ListOperation.parameters'
then:
function: schema
functionOptions:
schema:
type: array
items:
oneOf:
- type: object
properties:
name:
type: string
enum: ['filter']
in:
type: string
enum: ['query']
schema:
type: object
properties:
type:
type: string
enum: ['string']
required: ['name']
- type: object
properties:
name:
type: string
enum: ['order_by']
in:
type: string
enum: ['query']
schema:
type: object
properties:
type:
type: string
enum: ['string']
required: ['name']
- type: object
properties:
name:
type: string
enum: ['show_deleted']
in:
type: string
enum: ['query']
schema:
type: object
properties:
type:
type: string
enum: ['boolean']
required: ['name']
- type: object
properties:
name:
type: string
not:
enum: ['filter', 'order_by', 'show_deleted']
required: ['name']
aep-132-required-params:
description: List operation should have no required parameters (except path parameters)
severity: error
formats: ['oas3']
given:
- '#ListOperation.parameters[?(@.in != "path")]'
then:
field: required
function: falsy