-
Notifications
You must be signed in to change notification settings - Fork 65
/
.spectral.yaml
170 lines (169 loc) · 5.11 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: Copyright 2022 Micron Technology, Inc.
# Used for validating the docs/openapi.json file
extends: [[spectral:oas, recommended]]
rules:
operation-id-format:
description: Operation IDs must be kebab case.
message: "{{description}} {{error}}"
given: "$.paths[*][get,put,post,delete,options,head,patch,trace]"
severity: error
then:
field: operationId
function: casing
functionOptions:
type: kebab
operation-tags-allowed:
description: Only certain tags are allowed.
message: "{{description}} {{error}}"
given: "$.paths[*][get,put,post,delete,options,head,patch,trace]"
severity: error
then:
field: tags
function: schema
functionOptions:
schema:
type: array
minItems: 1
maxItems: 1
items:
type: string
enum:
- global
- kvdb
- kvs
operations-must-have-x-options:
description: Operations must have x-options.
message: "{{description}} {{error}}"
given: "$.paths[*][get,put,post,delete,options,head,patch,trace]"
severity: error
then:
field: x-options
function: truthy
x-alias-schema:
description: x-alias must have the correct schema.
message: "{{description}} {{error}}"
given: "$.paths[*][get,put,post,delete,options,head,patch,trace].x-alias"
severity: error
then:
function: schema
functionOptions:
schema:
type: string
pattern: "^[a-z][a-z-]*[a-z]$"
x-hide-schema:
description: x-hide must have the correct schema.
message: "{{description}} {{error}}"
given: "$.paths[*][get,put,post,delete,options,head,patch,trace].x-hide"
severity: error
then:
function: schema
functionOptions:
schema:
type: boolean
x-options-schema:
description: x-options must have the correct schema.
message: "{{description}} {{error}}"
given: "$.paths[*][get,put,post,delete,options,head,patch,trace]"
severity: error
then:
field: x-options
function: schema
functionOptions:
schema:
type: array
items:
type: object
properties:
long:
type: string
short:
type: string
minLength: 1
maxLength: 1
description:
type: string
requires-arguments:
type: boolean
parameter:
type: string
pattern: "^#\/[a-zA-Z0-9]+[a-zA-Z0-9\/]"
required:
- long
- short
- description
x-formats-schema:
description: x-formats must have the correct schema.
message: "{{description}} {{error}}"
given: "$.paths[*][get,put,post,delete,options,head,patch,trace].x-formats"
severity: error
then:
function: schema
functionOptions:
schema:
type: object
minProperties: 1
properties:
json:
type: object
maxProperties: 0
plain:
type: object
maxProperties: 0
tab:
type: object
oneOf:
- properties:
type:
type: string
enum:
- array
config:
type: object
properties:
columns:
type: object
patternProperties:
"[A-Z_]+":
type: object
properties:
pointer:
type: string
pattern: "^\/[a-zA-Z0-9\/]+"
justify:
type: string
enum:
- left
- right
required:
- pointer
- justify
required:
- columns
required:
- type
- config
- properties:
type:
type: string
enum:
- custom
required:
- type
- properties:
type:
type: string
enum:
- flattened
config:
type: object
properties:
columns:
type: array
maxItems: 2
items:
type: string
required:
- type
- config