-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaddy-api-rules.yml
More file actions
74 lines (67 loc) · 2.39 KB
/
taddy-api-rules.yml
File metadata and controls
74 lines (67 loc) · 2.39 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
69
70
71
72
73
74
extends: spectral:oas
rules:
taddy-graphql-endpoint-must-be-post:
description: Taddy GraphQL API only accepts POST requests
message: "GraphQL endpoints must use POST method"
severity: error
given: "$.paths['/'].get"
then:
function: undefined
taddy-request-must-include-query:
description: All GraphQL requests must include a query field
message: "Request body must include a 'query' property"
severity: error
given: "$.paths['/'].post.requestBody.content['application/json'].schema"
then:
field: required
function: truthy
taddy-auth-headers-documented:
description: API must document X-API-KEY and X-USER-ID authentication headers
message: "API key authentication headers must be documented in securitySchemes"
severity: warn
given: "$.components.securitySchemes"
then:
function: truthy
taddy-operations-have-examples:
description: GraphQL operations should include request examples
message: "Request body should include examples for key GraphQL queries"
severity: info
given: "$.paths['/'].post.requestBody.content['application/json'].examples"
then:
function: truthy
taddy-response-includes-data-field:
description: GraphQL responses should document the data wrapper
message: "Response schema should include a 'data' property"
severity: warn
given: "$.paths['/'].post.responses['200'].content['application/json'].schema.properties"
then:
field: data
function: truthy
taddy-schemas-have-descriptions:
description: All schema components should have descriptions
message: "{{property}} is missing a description"
severity: warn
given: "$.components.schemas[*]"
then:
field: description
function: truthy
taddy-uuid-fields-are-strings:
description: UUID identifier fields must be typed as string
message: "UUID field '{{property}}' should be type: string"
severity: error
given: "$.components.schemas[*].properties.uuid"
then:
field: type
function: pattern
functionOptions:
match: "^string$"
taddy-url-fields-use-uri-format:
description: URL fields should use format uri
message: "URL field '{{property}}' should use format: uri"
severity: warn
given: "$.components.schemas[*].properties[*Url]"
then:
field: format
function: pattern
functionOptions:
match: "^uri$"