-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtravelers-rules.yml
More file actions
101 lines (91 loc) · 2.68 KB
/
Copy pathtravelers-rules.yml
File metadata and controls
101 lines (91 loc) · 2.68 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
extends: spectral:oas
rules:
travelers-operation-summary-title-case:
description: All operation summaries must use Title Case
severity: warn
given: "$.paths[*][*].summary"
then:
function: pattern
functionOptions:
match: "^[A-Z][a-zA-Z]*(\\s[A-Z][a-zA-Z]*)*$"
travelers-operationid-required:
description: All operations must have an operationId
severity: error
given: "$.paths[*][*]"
then:
field: operationId
function: truthy
travelers-tags-required:
description: All operations must have tags
severity: warn
given: "$.paths[*][*]"
then:
field: tags
function: truthy
travelers-oauth2-required:
description: Insurance API should use OAuth2 authentication
severity: warn
given: "$.components.securitySchemes[*]"
then:
field: type
function: enumeration
functionOptions:
values:
- oauth2
- http
travelers-response-200-get:
description: GET operations must have a 200 response
severity: error
given: "$.paths[*].get.responses"
then:
field: "200"
function: truthy
travelers-response-201-post:
description: POST operations that create resources should return 201
severity: warn
given: "$.paths[*].post.responses"
then:
field: "201"
function: truthy
travelers-claim-number-in-path:
description: Claim endpoints should use claim_number as path parameter
severity: hint
given: "$.paths['/claims/{claim_number}'][*].parameters[*][?(@.name=='id')]"
then:
function: falsy
travelers-policy-type-enum:
description: Policy types should be validated against known types
severity: warn
given: "$.components.schemas[*].properties.policy_type"
then:
field: enum
function: truthy
travelers-date-format:
description: Date fields should use ISO 8601 date format
severity: warn
given: "$.components.schemas[*].properties[?(@.format=='date')]"
then:
field: format
function: enumeration
functionOptions:
values:
- date
- date-time
travelers-data-wrapper:
description: Responses should wrap content in a data property
severity: warn
given: "$.components.schemas[?(@property.match(/Response$/))].properties"
then:
field: data
function: truthy
travelers-amount-format:
description: Monetary amount fields should use number format float
severity: hint
given: "$.components.schemas[*].properties[?(@.property.match(/amount|premium|incurred/i))]"
then:
field: format
function: enumeration
functionOptions:
values:
- float
- double