Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions schemas/jsonrpc/v2.0/batch-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Batch Request",
"description": "An array of request objects sent to the server in a single batch",
"$comment": "https://www.jsonrpc.org/specification#batch",
"examples": [
[
{
"id": "1",
"jsonrpc": "2.0",
"method": "sum",
"params": [ 1, 2, 4 ]
},
{
"jsonrpc": "2.0",
"method": "notify_hello",
"params": [ 7 ]
},
{
"id": "2",
"jsonrpc": "2.0",
"method": "subtract",
"params": [ 42, 23 ]
}
],
[
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_data"
}
],
[
{
"jsonrpc": "2.0",
"method": "notify_update"
},
{
"id": "req-1",
"jsonrpc": "2.0",
"method": "fetch",
"params": {
"key": "value"
}
}
]
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": "array",
"minItems": 1,
"items": {
"anyOf": [
{
"$ref": "./request.json"
},
{
"$ref": "./notification.json"
}
]
}
}
53 changes: 53 additions & 0 deletions schemas/jsonrpc/v2.0/batch-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Batch Response",
"description": "An array of response objects returned by the server in response to a batch request",
"$comment": "https://www.jsonrpc.org/specification#batch",
"examples": [
[
{
"id": "1",
"jsonrpc": "2.0",
"result": 7
},
{
"id": "2",
"jsonrpc": "2.0",
"result": 19
},
{
"id": null,
"error": {
"code": -32600,
"message": "Invalid Request"
},
"jsonrpc": "2.0"
}
],
[
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"status": "ok"
}
}
],
[
{
"id": "req-1",
"error": {
"code": -32601,
"message": "Method not found"
},
"jsonrpc": "2.0"
}
]
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": "array",
"minItems": 1,
"items": {
"$ref": "./response.json"
}
}
42 changes: 42 additions & 0 deletions schemas/jsonrpc/v2.0/code-predefined.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Predefined Error Code",
"description": "An error code from the predefined range reserved by the JSON-RPC 2.0 specification",
"$comment": "https://www.jsonrpc.org/specification#error_object",
"examples": [ -32700, -32600, -32601, -32602, -32603, -32000 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": "integer",
"anyOf": [
{
"title": "Parse error",
"description": "Invalid JSON was received by the server",
"const": -32700
},
{
"title": "Invalid request",
"description": "The JSON sent is not a valid Request object",
"const": -32600
},
{
"title": "Method not found",
"description": "The method does not exist / is not available",
"const": -32601
},
{
"title": "Invalid params",
"description": "Invalid method parameter(s)",
"const": -32602
},
{
"title": "Internal error",
"description": "Internal JSON-RPC error",
"const": -32603
},
{
"title": "Server error",
"description": "Implementation-defined server error",
"maximum": -32000,
"minimum": -32099
}
]
}
16 changes: 16 additions & 0 deletions schemas/jsonrpc/v2.0/code.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Error Code",
"description": "A number that indicates the error type that occurred",
"$comment": "https://www.jsonrpc.org/specification#error_object",
"examples": [ -32700, -32600, -32601, -32000, 100, -1 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"anyOf": [
{
"$ref": "./code-predefined.json"
},
{
"type": "integer"
}
]
}
39 changes: 39 additions & 0 deletions schemas/jsonrpc/v2.0/error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Error Object",
"description": "An object that describes an error that occurred during the request",
"$comment": "https://www.jsonrpc.org/specification#error_object",
"examples": [
{
"code": -32600,
"message": "Invalid Request"
},
{
"code": -32601,
"message": "Method not found"
},
{
"code": -32000,
"data": {
"details": "Database connection failed"
},
"message": "Server error"
}
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": "object",
"required": [ "code", "message" ],
"properties": {
"code": {
"description": "The error type",
"$ref": "./code.json"
},
"data": {
"description": "Additional error information"
},
"message": {
"description": "The error description",
"type": "string"
}
}
}
9 changes: 9 additions & 0 deletions schemas/jsonrpc/v2.0/identifier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Identifier",
"description": "An identifier established by the client that must be matched in the response if included in a request",
"$comment": "https://www.jsonrpc.org/specification#request_object",
"examples": [ "abc123", 42, null, "request-1" ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": [ "string", "integer", "null" ]
}
10 changes: 10 additions & 0 deletions schemas/jsonrpc/v2.0/method-internal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Internal Method Name",
"description": "A method name reserved for system extensions that begins with the prefix 'rpc.'",
"$comment": "https://www.jsonrpc.org/specification#request_object",
"examples": [ "rpc.discover", "rpc.introspect", "rpc.system.info" ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": "string",
"pattern": "^rpc\\."
}
16 changes: 16 additions & 0 deletions schemas/jsonrpc/v2.0/method.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Method Name",
"description": "A string containing the name of the method to be invoked",
"$comment": "https://www.jsonrpc.org/specification#request_object",
"examples": [ "subtract", "update", "notify_hello", "rpc.discover", "sum" ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"anyOf": [
{
"$ref": "./method-internal.json"
},
{
"type": "string"
}
]
}
46 changes: 46 additions & 0 deletions schemas/jsonrpc/v2.0/notification.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Notification",
"description": "A request object without an identifier that must not be responded to by the server",
"$comment": "https://www.jsonrpc.org/specification#notification",
"examples": [
{
"jsonrpc": "2.0",
"method": "update"
},
{
"jsonrpc": "2.0",
"method": "notify_hello",
"params": [ 7 ]
},
{
"jsonrpc": "2.0",
"method": "notify_sum",
"params": {
"a": 1,
"b": 2
}
}
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": "object",
"required": [ "jsonrpc", "method" ],
"properties": {
"id": {
"description": "Must not be included",
"not": true
},
"jsonrpc": {
"description": "The protocol version",
"const": "2.0"
},
"method": {
"description": "The method name",
"$ref": "./method.json"
},
"params": {
"description": "The method parameters",
"$ref": "./parameters.json"
}
}
}
16 changes: 16 additions & 0 deletions schemas/jsonrpc/v2.0/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Parameter Structures",
"description": "A structured value that holds the parameter values to be used during the invocation of the method",
"$comment": "https://www.jsonrpc.org/specification#parameter_structures",
"examples": [
[ 42, "foo" ],
{
"age": 30,
"name": "John"
},
[]
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": [ "array", "object" ]
}
50 changes: 50 additions & 0 deletions schemas/jsonrpc/v2.0/request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "JSON-RPC 2.0 Request Object",
"description": "An object that represents a call to a method on the server",
"$comment": "https://www.jsonrpc.org/specification#request_object",
"examples": [
{
"id": 1,
"jsonrpc": "2.0",
"method": "subtract",
"params": [ 42, 23 ]
},
{
"id": 3,
"jsonrpc": "2.0",
"method": "subtract",
"params": {
"minuend": 42,
"subtrahend": 23
}
},
{
"id": "req-001",
"jsonrpc": "2.0",
"method": "update",
"params": [ 1, 2, 3, 4, 5 ]
}
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"type": "object",
"required": [ "jsonrpc", "method", "id" ],
"properties": {
"id": {
"description": "The request identifier",
"$ref": "./identifier.json"
},
"jsonrpc": {
"description": "The protocol version",
"const": "2.0"
},
"method": {
"description": "The method name",
"$ref": "./method.json"
},
"params": {
"description": "The method parameters",
"$ref": "./parameters.json"
}
}
}
Loading