-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy path.spectral.yaml
113 lines (107 loc) · 8.31 KB
/
.spectral.yaml
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
extends: "spectral:oas"
formats: ["oas2", "oas3"]
rules:
property-snake-case:
description: Property names should match snake case
message: "{{path}} does not match snake case"
given: $..properties.*~
severity: error
then:
function: pattern
functionOptions:
match: '^[a-z]+[a-z0-9_]*[a-z0-9]+$'
property-description:
description: Every non-array type should define a description
message: "{{path}} does not define description"
given: $..[?((@property=='items' || @parentProperty=='properties') && @.type != 'array')]
severity: error
then:
field: description
function: truthy
property-example:
description: Scalar types (except for boolean) should define an example
message: "{{path}} does not define an example"
given: $..[?((@property=='items' || @parentProperty=='properties') && @.type != 'array' && @.type != 'object' && @.type != 'boolean' && @.type != null)]
severity: error
then:
field: example
function: truthy
property-string-max-length:
description: Every string type should define a max length
message: "{{path}} does not define max length"
given: $..[?((@property=='items' || @parentProperty=='properties') && @.type == 'string')]
severity: error
then:
field: maxLength
function: truthy
property-field-sentence:
description: Description of a field should be a sentence
message: "{{path}} is not a sentence"
given: $..[?(@property=='description')]
severity: error
then:
function: pattern
functionOptions:
match: '^[A-Z]+\S*(?:\s+\S+){2,}\s*$'
property-arbitrary-object-without-keys:
description: Every object should have defined keys
message: "{{path}} is an object without defined keys"
given: $..[?(@.type == 'object')]
severity: error
then:
field: properties
function: truthy
# TODO: remove these exceptions as we clean up the schema and clarify in RHCLOUD-8147
except:
'schemas/system_profile/v1.yaml#/%24defs/DiskDevice/properties/device': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/DiskDevice/properties/label': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/DiskDevice/properties/options/properties/name': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/DiskDevice/properties/options/properties/value': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/NetworkInterface/properties/mtu': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/YumRepo/properties/id': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/YumRepo/properties/name': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/YumRepo/properties/gpgcheck': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/YumRepo/properties/enabled': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/YumRepo/properties/base_url': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/DnfModule/properties/name': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/DnfModule/properties/stream': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/InstalledProduct/properties/name': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/NetworkInterface/properties/ipv4_addresses/items': ['property-example', 'property-description', 'property-string-max-length']
'schemas/system_profile/v1.yaml#/%24defs/NetworkInterface/properties/ipv6_addresses/items': ['property-example', 'property-description', 'property-string-max-length']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/cpu_flags/items': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/kernel_modules/items': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/running_processes/items': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/installed_services/items': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/enabled_services/items': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/number_of_cpus': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/number_of_sockets': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/cores_per_socket': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/system_memory_bytes': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/infrastructure_type': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/infrastructure_vendor': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/bios_vendor': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/bios_version': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/bios_release_date': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/os_release': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/os_kernel_version': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/arch': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/last_boot_time': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/subscription_status': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/subscription_auto_attach': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/katello_agent_running': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/satellite_managed': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/cloud_provider': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/insights_client_version': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/insights_egg_version': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/captured_date': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/bootc_status/properties/booted': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/bootc_status/properties/rollback': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/bootc_status/properties/cachedUpdate':
- property-example
- property-snake-case
'schemas/system_profile/v1.yaml#/%24defs/SystemProfile/properties/bootc_status/properties/staged': ['property-example', 'property-description']
'schemas/system_profile/v1.yaml#/%24defs/NestedObject': ['property-arbitrary-object-without-keys']
'schemas/system_profile/v1.yaml#/%24defs/NestedObject/additionalProperties/oneOf/1/not': ['property-arbitrary-object-without-keys']
'schemas/system_profile/v1.yaml#/%24defs/DiskDevice/properties/options': ['property-arbitrary-object-without-keys']
'schemas/system_profile/v1.yaml#/%24id': ['property-description', 'property-example']
'schemas/system_profile/v1.yaml#/%24schema': ['property-description', 'property-example']