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
# The port to listen on (currently the graphql endpoint is simply served on "/"
# but support for serving different subgraphs at different routes is planned
port: 8080
# Whether or not cache responses against the hash of the request 'query' field
# in order to reduce natural (non-injected) latency and resource usage.
# This is not always desirable but is sometimes needed when working with graphs
# that use giant queries like Expedia.
cache_responses: true
# Additional response headers to set for every response.
# "Content-type: application/json" is automatically set for all graphQL responses
# by default.
headers:
MyHeader: "my-header-value"
# Currently matching the latency generation config from the router-scale Go
# "subgraph" mock server.
# Total latency is the sum of the base latency and any defined waveforms.
latency:
# Base latency to apply _after_ response generation.
base: 5ms
# Latency waveforms: allowed keys are "sine", "saw", "square", "triangle"
# and all options have the same sub-keys of "amplitude" and "period" for
# the waveform.
sine:
amplitude: 2ms
period: 10s
# Configuration for how responses should be generated for incoming graphQL
# requests. What is shown below is the current default configuration that
# will be used. Additional scalar generators can be defined and the existing
# defaults can be overwritten as needed.
response_generation:
# How frequently to set nullable fields to null
null_ratio:
# How frequently to include a particular header
header_ratio:
MyHeader:
# Minimum and maximum lengths for array fields
array:
min_length: 0
max_length: 10
# Response error configurations. Note that these ratios are sequential.
# This means that if you set all 3 ratios, the HTTP errors ratio resolves first,
# then the GraphQL response errors will be a ratio of the successful HTTP requests,
# then the GraphQL field errors will be a ratio of the successful GraphQL responses.
#
# The ratio of requests that should fail with a HTTP 5xx error. Defaults to no failures.
http_error_ratio:
graphql_errors:
# The ratio of successful HTTP requests that should fail with a GraphQL request error and no data.
request_error_ratio:
# The ratio of successful GraphQL requests that should return partial data and field-level errors.
field_error_ratio:
# Custom scalar generators. Below is the default setup for built-in
# scalars plus "ID". Keys must exactly match the scalar name found
# in the schema provided to the server, unmatched scalars will be
# defaulted to being represented as strings with lengths 1-10.
scalars:
Boolean:
type: bool
Float:
type: float
min: -1.0
max: 1.0
Int:
type: int
min: 0
max: 100
ID:
type: int
min: 0
max: 100
String:
type: string
min_len: 1
max_len: 10
# Any value except the listening port in the configuration can be
# overridden at a per-subgraph level. Subgraphs do not map 1:1 with
# running servers so the port must remain a shared configuration.
subgraph_overrides:
# Each subgraph is a top-level key in the overrides and must match
# the name that the router will try to hit when making a request.
my_subgraph_name:
# Any overrides here will be merged with the values provided in
# the base configuration.
cache_responses: false
response_generation:
null_ratio:
header_ratio:
MyHeader:
array:
min_length: 5