-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move request-schema.json to a .py file (#284)
- Loading branch information
Showing
2 changed files
with
18 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 14 additions & 21 deletions
35
jsonrpcserver/request-schema.json → jsonrpcserver/request_schema.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,32 @@ | ||
{ | ||
REQUEST_SCHEMA = { | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"description": "A JSON RPC 2.0 request", | ||
"oneOf": [ | ||
{ | ||
"description": "An individual request", | ||
"$ref": "#/definitions/request" | ||
}, | ||
{"description": "An individual request", "$ref": "#/definitions/request"}, | ||
{ | ||
"description": "An array of requests", | ||
"type": "array", | ||
"items": { "$ref": "#/definitions/request" }, | ||
"minItems": 1 | ||
} | ||
"items": {"$ref": "#/definitions/request"}, | ||
"minItems": 1, | ||
}, | ||
], | ||
"definitions": { | ||
"request": { | ||
"type": "object", | ||
"required": [ "jsonrpc", "method" ], | ||
"required": ["jsonrpc", "method"], | ||
"properties": { | ||
"jsonrpc": { "enum": [ "2.0" ] }, | ||
"method": { | ||
"type": "string" | ||
}, | ||
"jsonrpc": {"enum": ["2.0"]}, | ||
"method": {"type": "string"}, | ||
"id": { | ||
"type": [ "string", "number", "null" ], | ||
"type": ["string", "number", "null"], | ||
"note": [ | ||
"While allowed, null should be avoided: http://www.jsonrpc.org/specification#id1", | ||
"While allowed, a number with a fractional part should be avoided: http://www.jsonrpc.org/specification#id2" | ||
] | ||
"While allowed, a number with a fractional part should be avoided: http://www.jsonrpc.org/specification#id2", | ||
], | ||
}, | ||
"params": { | ||
"type": [ "array", "object" ] | ||
} | ||
"params": {"type": ["array", "object"]}, | ||
}, | ||
"additionalProperties": false | ||
"additionalProperties": False, | ||
} | ||
} | ||
}, | ||
} |