-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththoughtly-rules.yml
More file actions
68 lines (63 loc) · 2.03 KB
/
Copy paththoughtly-rules.yml
File metadata and controls
68 lines (63 loc) · 2.03 KB
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
extends:
- spectral:oas
documentationUrl: https://docs.thoughtly.com/developers
rules:
thoughtly-server-url:
description: All Thoughtly API specs must declare the canonical production server.
message: Servers must include https://api.thoughtly.com
severity: error
given: $.servers[*].url
then:
function: pattern
functionOptions:
match: '^https://api\.thoughtly\.com'
thoughtly-require-api-token-security:
description: Every operation must require the ApiKeyAuth (x-api-token) security scheme except public webhook trigger endpoints.
message: Operation must require ApiKeyAuth security.
severity: warn
given: $.paths.*[?(@.operationId)]
then:
field: security
function: truthy
thoughtly-summary-title-case:
description: Operation summaries should use Title Case (the API Evangelist convention).
severity: warn
given: $.paths.*[?(@.summary)].summary
then:
function: pattern
functionOptions:
match: '^[A-Z][A-Za-z0-9]*(\s+[A-Z][A-Za-z0-9]*)*$'
thoughtly-generic-response-schema:
description: 2xx JSON responses should reference the GenericResponse schema.
severity: hint
given: $.paths.*.*.responses.200.content.application/json.schema
then:
function: schema
functionOptions:
schema:
type: object
properties:
$ref:
type: string
pattern: '#/components/schemas/GenericResponse'
thoughtly-tag-known:
description: Operations should be tagged with one of the documented tag categories.
severity: warn
given: $.paths.*.*.tags[*]
then:
function: enumeration
functionOptions:
values:
- agent
- contact
- user
- webhooks
thoughtly-operation-id:
description: Every operation must declare a camelCase operationId.
severity: warn
given: $.paths.*[?(@.summary)]
then:
field: operationId
function: pattern
functionOptions:
match: '^[a-z][A-Za-z0-9]*$'