-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutilityapi-rules.yml
More file actions
84 lines (77 loc) · 2.52 KB
/
utilityapi-rules.yml
File metadata and controls
84 lines (77 loc) · 2.52 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
extends:
- spectral:oas
rules:
utilityapi-bearer-auth-required:
description: All operations must use bearerAuth security
message: Operation must use bearerAuth security scheme
severity: error
given: "$.paths[*][*]"
then:
function: schema
functionOptions:
schema:
type: object
properties:
security:
type: array
required:
- security
utilityapi-uid-path-parameters:
description: Path parameters for resource IDs should be named 'uid'
message: Resource identifier path parameters should be named 'uid'
severity: warn
given: "$.paths[*][*].parameters[*]"
then:
function: pattern
field: name
functionOptions:
match: "^(uid|username|name|provider|architecture|version)$"
utilityapi-pagination-next-cursor:
description: List endpoints should support 'next' cursor pagination
message: List operations should include 'next' cursor parameter
severity: warn
given: "$.paths[*].get"
then:
function: truthy
field: parameters
utilityapi-list-response-envelope:
description: List responses should use plural noun envelope
message: List responses should wrap items in a plural noun envelope
severity: warn
given: "$.paths[*].get.responses.200.content.application/json.schema"
then:
function: truthy
field: properties
utilityapi-operations-must-have-summaries:
description: All operations must have a summary
message: Operations must have a summary field
severity: error
given: "$.paths[*][get,post,put,delete,patch]"
then:
function: truthy
field: summary
utilityapi-operations-must-have-tags:
description: All operations must have at least one tag
message: Operations should be tagged for organization
severity: warn
given: "$.paths[*][get,post,put,delete,patch]"
then:
function: truthy
field: tags
utilityapi-error-response-defined:
description: Operations should define 401 error responses
message: Operations should document 401 Unauthorized responses
severity: warn
given: "$.paths[*][get,post,put,delete,patch].responses"
then:
function: truthy
field: '401'
utilityapi-operation-ids-camel-case:
description: Operation IDs should use camelCase
message: OperationId should use camelCase naming
severity: warn
given: "$.paths[*][*].operationId"
then:
function: pattern
functionOptions:
match: "^[a-z][a-zA-Z0-9]+$"