forked from italia/api-oas-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata.yml
80 lines (75 loc) · 2.1 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
rules:
has-x-summary:
message: >-
API MUST have an one-liner #/info/x-summary field
containing a brief description.
description: >-
The `#/info/x-summary` can be used to specify a brief, one-liner
description of your API: this is very useful for catalog purposes
(eg. this can be shown as your API subtitle in catalogs and developer
portals).
In OAS3.1 you can use the standard `#/info/summary` field.
given: $
severity: error
recommended: true
type: style
formats:
- oas3
then:
field: "info.x-summary"
function: truthy
has-termsOfService:
message: >-
API MUST reference the URL of the Terms of Service
in #/info/termsOfService.
description: >-
API MUST reference the URL of the Terms of Service
in `#/info/termsOfService`
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 in #/info/contact
given: $
severity: error
recommended: true
type: style
formats:
- oas3
then:
field: "info.contact"
function: truthy
has-x-api-id:
message: >-
API must have an unique identifier in x-api-id in #/info/x-api-id.
description: |-
The `#/info/x-api-id` field can be used to associate an identifier
to an API.
This is useful to track an API even when its `#/info/title` changes.
given: $
severity: error
recommended: true
type: style
then:
field: "info.x-api-id"
function: truthy
use-semver:
description: |-
The API version field should follow
[semantic versioning](https://semver.org/#semantic-versioning-specification-semver).
severity: error
recommended: true
message: >-
Specs should follow semantic versioning. {{value}} is not a valid version.
given: $.info.version
then:
function: pattern
functionOptions:
match: "^[0-9]+.[0-9]+.[0-9]+(-[a-z0-9+.-]+)?"