forked from italia/api-oas-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
casing.yml
68 lines (62 loc) · 1.79 KB
/
casing.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
rules:
paths-kebab-case:
description: |
Paths should be kebab-case (e.g. `path-parameter`).
See Italian recommendation RAC_REST_NAME_002.
message: '{{property}} is not kebab-case: {{error}}'
severity: warn
recommended: true
given: $.paths[*]~
then:
# BEWARE: don't use `casing` because this pattern allows
# for non-kebab parameters in the path.
function: pattern
functionOptions:
match: "^(\/[a-z0-9-.]+|\/{[a-zA-Z0-9_]+})+$"
request-headers-pascal-case: &request-headers-pascal-case
description: |
Headers should be pascal-case, separated by hyphens (e.g. `PascalCase-Header`)
See Italian recommendation RAC_REST_NAME_003.
message: '{{value}} {{error}} in {{path}}'
severity: hint
recommended: true
given:
- $..[parameters][?(@.in=="header")].name
then:
function: casing
functionOptions:
type: pascal
separator:
char: '-'
response-headers-pascal-case:
<<: *request-headers-pascal-case
message: 'Header {{error}}: {{path}}'
given:
- $..[responses][*].headers.*~
schema-camel-case:
description: |-
Schema definitions should be CamelCase
(pascal case with blank separator char).
This improves readability and avoid
confusion between schema names and properties.
```
Website:
type: string
format: url
Person:
type: object
properties:
website:
$ref: "#/components/schemas/Website"
```
message: 'Schema name should be CamelCase in {{path}}'
severity: hint
recommended: true
given: >-
$.components.schemas[*]~
then:
function: casing
functionOptions:
type: pascal
separator:
char: ""