forked from italia/api-oas-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetadata.yml
88 lines (82 loc) · 2.14 KB
/
metadata.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
rules:
servers-description:
description: Servers must have a description.
message: >-
Server {{path}} must have a description.
given: $.servers[*]
severity: error
recommended: true
then:
field: description
function: truthy
servers-use-https:
description: Servers must use https
message: >-
Non-sandbox url {{value}} {{error}}. Add `x-sandbox: true` to declare the server as a sandbox.
given: >-
$.servers[?(@["x-sandbox"] != true)]
severity: error
recommended: true
then:
field: url
function: pattern
functionOptions:
match: ^https://.*
has-x-summary:
description: >-
API must have an one-liner summary field in x-summary {{path}}
given: $
severity: error
recommended: true
type: style
formats:
- oas3
then:
field: "info.x-summary"
function: truthy
has-termsOfService:
description: >-
API MUST reference the URL of the Terms of Service {{path}}
given: $
severity: error
recommended: true
type: style
formats:
- oas3
then:
field: "info.termsOfService"
function: truthy
has-contact:
description: >-
API MUST reference a contact, either url or email: {{path}}
given: $
severity: error
recommended: true
type: style
formats:
- oas3
then:
field: "info.contact"
function: truthy
has-x-api-id:
description: >-
API must have an unique identifier in x-api-id {{path}}
given: $
severity: error
recommended: true
type: style
then:
field: "info.x-api-id"
function: truthy
paths-kebab-case:
description: |
Paths should be kebab-case.
See https://docs.italia.it/italia/piano-triennale-ict/lg-modellointeroperabilita-docs/it/bozza/doc/profili-di-interazione/regole-comuni-rest-soap.html#usare-parole-separate-da-trattino-per-i-path-kebab-case
message: '{{property}} is not kebab-case: {{error}}'
severity: warn
recommended: true
given: $.paths[*]~
then:
function: pattern
functionOptions:
match: "^(\/[a-z0-9-.]+|\/{[a-zA-Z0-9_]+})+$"