-
Notifications
You must be signed in to change notification settings - Fork 9
/
.spectral.yaml
44 lines (44 loc) · 1.29 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
rules:
paths-camel-case:
description: Should paths be camel-case.
message: "{{property}} is not camel-case: {{error}}"
severity: warn
recommended: true
given: $.paths[*]~
then:
function: pattern
functionOptions:
match: "^(\/[a-z{}]+[A-Za-z0-9{}]*[a-z0-9{}]+)+$"
# parameter-description:
# description: Parameters must have a description.
# recommended: true
# given: "$..properties.*"
# then:
# field: description
# function: truthy
api-servers:
description: "OpenAPI `servers` must be present and non-empty array."
recommended: true
formats: ["oas3"]
given: "$"
then:
field: servers
function: schema
functionOptions:
schema:
items:
type: object
minItems: 1
type: array
operation-operationId-unique: true
no-x-headers:
description: "Please do not use headers with X-"
message: "Headers cannot start with X-, so please find a new name for {{property}}. More: https://tools.ietf.org/html/rfc6648"
recommended: true
type: style
# TODO add encoding headers too "$..content.*.encoding.*.headers"
given: "$..parameters.[?(@.in === 'header')].name"
then:
function: pattern
functionOptions:
notMatch: "^(x|X)-"