-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathruleset.bank.yml
120 lines (109 loc) · 3.92 KB
/
ruleset.bank.yml
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
118
119
120
aliases:
requestOrResponseJsonContent:
- "$..content[application/json]"
documentationUrl: https://www.guanchen.nl/
rules:
bank-tag-requires-industry-value:
description: Tags must be from the bank industry.
message:
This is not a bank industry value chain business capability keyword.
Please make sure there is at least one qualified tag name.
given:
- $.tags.*.name
severity: warn
then:
function: enumeration
functionOptions:
values:
- Supervisory
- Administrative
bank-path-requires-kebab-case:
description: Paths must be in kebab-case.
message: Path is not in kebab-case.
severity: warn
given: "$.paths[*]~"
then:
- function: pattern
functionOptions:
match: "^(/([a-z0-9]+(-[a-z0-9]+)*|\\{[a-zA-Z0-9_]+\\}))*$"
bank-header-requires-hyphenated-pascal-case:
description: HTTP headers must be in Hyphenated-Pascal-Case.
message: HTTP header is not in Hyphenated-Pascal-Case.
severity: warn
given:
- "$..parameters[?(@.in == 'header')].name"
- "$.components.securitySchemes[?(@.in == 'header')].name"
then:
function: pattern
functionOptions:
match: "^([A-Z][a-z0-9]*)(-[A-Z][a-z0-9]*)*$"
bank-property-requires-camel-case:
description: Property names, acronyms, path parameters and query parameters must be in camelCase.
message: Property name, acronym, path parameter or query parameter is not in camelCase.
severity: warn
given:
- "$..properties.*~"
- $.paths.*.*.parameters[?(@.in=='path' || @.in=='query')].name
- $.components.securitySchemes[?(@.in=='path' || @.in=='query')].name
then:
function: pattern
functionOptions:
match: ^[a-z][a-z0-9]*(([A-Z]{2}|[A-Z])[a-z0-9]+)*$
bank-parameter-description-required:
description: Parameters must have a description.
message: Parameter is missing a description.
severity: warn
given: $.paths.*.*.parameters[*]
then:
field: description
function: truthy
bank-summary-well-formed:
description: Operations must have a well-formed summary.
message:
Operation summary is not well-formed. Must start with a capital letter,
containing only letters, numbers, and spaces, and no dots, and the total length should be at most 25 characters.
severity: warn
given: "$..summary"
then:
- function: pattern
functionOptions:
match: ^[A-Z][a-zA-Z0-9\s]{0,24}$
bank-description-well-formed:
description: Security schemes, parameters and operations must have a well-formed description.
message: Security scheme, parameter or operation is not well-formed.
Each sentence must start with a capital letter, end with a period,
and the total length should be at least 15 characters. Markdown tables and URLs are allowed.
severity: warn
given:
- $.paths.*.*.description
- $.paths.*.*.parameters[*].description
- $.components.securitySchemes[*].description
then:
- function: pattern
functionOptions:
match: ^(?!.*\|.*\n)(?=[\s\S]{15,})[A-Z][\s\S]*[.]$
bank-operation-summary-required:
description: Operations must have a summary.
message: Operation is missing a summary.
severity: warn
given: $.paths.*.*
then:
field: summary
function: truthy
bank-operation-examples-required:
description: Object types must include at least one example.
message: Type is missing an example in the schema.
severity: warn
given: "#requestOrResponseJsonContent"
then:
field: schema.example
function: truthy
bank-operation-id-requires-pascal-case:
description: Operation id's must be in PascalCase (upper camel case).
message: Operation id is not in PascalCase.
severity: warn
given: "$..operationId"
then:
function: pattern
functionOptions:
match: "^[A-Z](([a-z0-9]+[A-Z]?)*)$"