-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtamara-rules.yml
More file actions
72 lines (72 loc) · 2.17 KB
/
Copy pathtamara-rules.yml
File metadata and controls
72 lines (72 loc) · 2.17 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
extends:
- spectral:oas
formats:
- oas3
rules:
tamara-info-contact:
description: All Tamara OpenAPI specs must include an info.contact block pointing to https://docs.tamara.co/.
severity: warn
given: $.info
then:
field: contact
function: truthy
tamara-servers-include-production:
description: Tamara specs must declare https://api.tamara.co (or https://partner-api.tamara.co for Channel Partners) as a server.
severity: warn
given: $.servers
then:
function: schema
functionOptions:
schema:
type: array
minItems: 1
contains:
type: object
properties:
url:
type: string
pattern: '^https://(api|partner-api)(-sandbox)?\.tamara\.co$'
required: [url]
tamara-bearer-auth:
description: Tamara endpoints must use bearer auth (the merchant or partner API token).
severity: warn
given: $.components.securitySchemes[*]
then:
function: schema
functionOptions:
schema:
type: object
properties:
type: { const: http }
scheme: { const: bearer }
required: [type, scheme]
tamara-currency-enum:
description: Money objects must restrict currency to Tamara's supported GCC currencies (SAR, AED, BHD, KWD, OMR).
severity: warn
given: $..properties.currency
then:
function: schema
functionOptions:
schema:
type: object
properties:
enum:
type: array
contains:
enum: [SAR, AED, BHD, KWD, OMR]
tamara-operation-summary-title-case:
description: OpenAPI operation summaries must be Title Case.
severity: warn
given: $.paths[*][get,post,put,patch,delete].summary
then:
function: pattern
functionOptions:
match: '^[A-Z][A-Za-z0-9]*(\s+[A-Z0-9][A-Za-z0-9]*)*$'
tamara-operation-id-camelcase:
description: operationId values should be camelCase.
severity: warn
given: $.paths[*][get,post,put,patch,delete].operationId
then:
function: pattern
functionOptions:
match: '^[a-z][A-Za-z0-9]*$'