-
Notifications
You must be signed in to change notification settings - Fork 6
/
response.json
68 lines (68 loc) · 1.8 KB
/
response.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
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A JSON RPC 2.0 response",
"oneOf": [
{ "$ref": "#/definitions/success" },
{ "$ref": "#/definitions/error" },
{
"type": "array",
"items": {
"oneOf": [
{ "$ref": "#/definitions/success" },
{ "$ref": "#/definitions/error" }
]
}
}
],
"definitions": {
"common": {
"required": [ "id", "jsonrpc" ],
"not": {
"description": "cannot have result and error at the same time",
"required": [ "result", "error" ]
},
"type": "object",
"properties": {
"id": {
"type": [ "string", "integer", "null" ],
"note": [
"spec says a number which should not contain a fractional part",
"We choose integer here, but this is unenforceable with some languages"
]
},
"jsonrpc": { "enum": [ "2.0" ] }
}
},
"success": {
"description": "A success. The result member is then required and can be anything.",
"allOf": [
{ "$ref": "#/definitions/common" },
{ "required": [ "result" ] }
]
},
"error": {
"allOf" : [
{ "$ref": "#/definitions/common" },
{
"required": [ "error" ],
"properties": {
"error": {
"type": "object",
"required": [ "code", "message" ],
"properties": {
"code": {
"type": "integer",
"note": [ "unenforceable in some languages" ]
},
"message": { "type": "string" },
"data": {
"description": "optional, can be anything"
}
}
}
}
}
]
}
}
}