-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathschema.json
129 lines (129 loc) · 6.5 KB
/
schema.json
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
{
"$id": "dataloader-config",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Schema for dataloader-codegen config file",
"type": "object",
"additionalProperties": false,
"properties": {
"typings": {
"type": "object"
},
"resources": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^.*$": {
"anyOf": [
{
"$ref": "#/definitions/batchInfo"
},
{
"$ref": "#/definitions/nonBatchInfo"
},
{
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^.*$": {
"anyOf": [
{
"$ref": "#/definitions/batchInfo"
},
{
"$ref": "#/definitions/nonBatchInfo"
},
{
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^.*$": {
"anyOf": [
{
"$ref": "#/definitions/batchInfo"
},
{
"$ref": "#/definitions/nonBatchInfo"
}
]
}
}
}
]
}
}
}
]
}
}
}
},
"definitions": {
"batchInfo": {
"type": "object",
"required": ["isBatchResource", "docsLink", "batchKey", "newKey"],
"additionalProperties": false,
"properties": {
"isBatchResource": {
"enum": [true]
},
"docsLink": {
"type": "string",
"description": "The URL for the documentation of this resource. Should point to a source of truth. Useful for others to verify information specified here is correct, and is used in stack traces."
},
"batchKey": {
"type": "string",
"description": "The argument to the resource that represents the list of entities we want to fetch. (e.g. 'user_ids')"
},
"newKey": {
"type": "string",
"description": "The argument we'll replace the batchKey with - should be a singular version of the batchKey (e.g. 'user_id')"
},
"reorderResultsByKey": {
"type": "string",
"description": "(Optional) If the resource itself does not guarantee ordering, this key specifies which key in the response objects corresponds to an element in `batchKey`. We use this to transfrom and re-order the response to the same order as in batchKey."
},
"nestedPath": {
"type": "string",
"description": "(Optional) If the resource returns the list of results in a nested path (e.g. `{ results: [ 1, 2, 3 ] }`), this tells the dataloader where in the response to find the results. (e.g. 'results')."
},
"commaSeparatedBatchKey": {
"type": "boolean",
"description": "(Optional) Set to true if the interface of the resource takes the batch key as a comma separated list (rather than an array of IDs, as is more common). Default: false"
},
"isResponseDictionary": {
"type": "boolean",
"description": "(Optional) Set to true if the batch resource returns the results as a dictionary with key mapped to values (instead of a list of items). If this option is supplied `reorderResultsByKey` should not be. Default: false"
},
"isBatchKeyASet": {
"type": "boolean",
"description": "(Optional) Set to true if the interface of the resource takes the batch key as a set (rather than an array). For example, when using a generated clientlib based on swagger where `uniqueItems: true` is set for the batchKey parameter. Default: false"
},
"propertyBatchKey": {
"type": "string",
"description": "(Optional) The argument to the resource that represents the optional properties we want to fetch. (e.g. usually 'properties' or 'features')"
},
"responseKey": {
"type": "string",
"description": "(Non-optional when propertyBatchKey is used) The key in the response objects corresponds to `batchKey`. This should be the only field that are marked as required in your swagger endpoint response, except nestedPath."
}
},
"dependencies": {
"propertyBatchKey": { "required": ["responseKey"] }
}
},
"nonBatchInfo": {
"type": "object",
"required": ["isBatchResource"],
"additionalProperties": false,
"properties": {
"isBatchResource": {
"enum": [false]
},
"docsLink": {
"type": "string",
"description": "The URL for the documentation of this resource. Should point to a source of truth. Useful for others to verify information specified here is correct, and is used in stack traces."
}
}
}
}
}