diff options
author | Everett Hildenbrandt <hildenb2@illinois.edu> | 2018-05-29 21:34:02 +0800 |
---|---|---|
committer | Everett Hildenbrandt <hildenb2@illinois.edu> | 2018-05-31 22:37:30 +0800 |
commit | 9bdd043874f02d7148319d1591a94094f72f135f (patch) | |
tree | 73aeda037291fd3c71099bc7f7dde5fd6c04f371 /JSONSchema | |
parent | ea227d5d888542ebd7c6e7d504a1ddf1a534761a (diff) | |
download | dexon-tests-9bdd043874f02d7148319d1591a94094f72f135f.tar dexon-tests-9bdd043874f02d7148319d1591a94094f72f135f.tar.gz dexon-tests-9bdd043874f02d7148319d1591a94094f72f135f.tar.bz2 dexon-tests-9bdd043874f02d7148319d1591a94094f72f135f.tar.lz dexon-tests-9bdd043874f02d7148319d1591a94094f72f135f.tar.xz dexon-tests-9bdd043874f02d7148319d1591a94094f72f135f.tar.zst dexon-tests-9bdd043874f02d7148319d1591a94094f72f135f.zip |
test.py, JSONSchema/*: factor out common schema definitions
Diffstat (limited to 'JSONSchema')
-rw-r--r-- | JSONSchema/bc-schema.json | 190 | ||||
-rw-r--r-- | JSONSchema/definitions.json | 200 | ||||
-rw-r--r-- | JSONSchema/st-filler-schema.json | 103 | ||||
-rw-r--r-- | JSONSchema/st-schema.json | 140 |
4 files changed, 200 insertions, 433 deletions
diff --git a/JSONSchema/bc-schema.json b/JSONSchema/bc-schema.json index 26ef855e1..b40f14219 100644 --- a/JSONSchema/bc-schema.json +++ b/JSONSchema/bc-schema.json @@ -106,138 +106,6 @@ } } }, - "EmptyString": { - "type": "string", - "pattern": "^$" - }, - "HexData": { - "description": "Hex data. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", - "pattern": "^0x([0-9a-fA-F][0-9a-fA-F])*$", - "type": "string" - }, - "HexQuantity": { - "description": "Hex quantity. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", - "pattern": "(^0x0$)|(^0x[1-9a-fA-F][0-9a-fA-F]*$)", - "type": "string" - }, - "ConfusedHexType": { - "anyOf": [ - { - "$ref": "#/definitions/HexData" - }, - { - "$ref": "#/definitions/HexQuantity" - } - ] - }, - "HexDataOrEmpty": { - "oneOf": [ - { - "$ref": "#/definitions/HexData" - }, - { - "$ref": "#/definitions/EmptyString" - } - ] - }, - "HexNoPrefix": { - "pattern": "^([0-9a-fA-F][0-9a-fA-F])+$", - "type": "string" - }, - "HexMaybePrefix": { - "oneOf": [ - { - "$ref": "#/definitions/HexNoPrefix" - }, - { - "$ref": "#/definitions/HexData" - } - ] - }, - "HexMaybePrefixOrEmpty": { - "oneOf": [ - { - "$ref": "#/definitions/HexMaybePrefix" - }, - { - "$ref": "#/definitions/EmptyString" - } - ] - }, - "IntegerString": { - "pattern": "^[0-9]+$", - "type": "string" - }, - "IntegerOrEmpty": { - "oneOf": [ - { - "$ref": "#/definitions/IntegerString" - }, - { - "$ref": "#/definitions/EmptyString" - } - ] - }, - "IntegerOrNumber": { - "oneOf": [ - { - "$ref": "#/definitions/IntegerString" - }, - { - "type": "number" - } - ] - }, - "IntegerOrNumberOrConfusedHex": { - "oneOf": [ - { - "$ref": "#/definitions/IntegerOrNumber" - }, - { - "$ref": "#/definitions/ConfusedHexType" - } - ] - }, - "IntegerOrEmptyOrHexQuantity": { - "oneOf": [ - { - "$ref": "#/definitions/IntegerOrEmpty" - }, - { - "$ref": "#/definitions/HexQuantity" - } - ] - }, - "IntegerOrHexQuantity": { - "oneOf": [ - { - "$ref": "#/definitions/IntegerString" - }, - { - "$ref": "#/definitions/HexQuantity" - } - ] - }, - "IntegerOrConfusedHex": { - "anyOf": [ - { - "$ref": "#/definitions/IntegerString" - }, - { - "$ref": "#/definitions/ConfusedHexType" - } - ] - }, - "IntegerOrEmptyOrConfusedHex": { - "oneOf": [ - { - "$ref": "#/definitions/IntegerOrEmpty" - }, - { - "$ref": "#/definitions/ConfusedHexType" - } - ] - }, "PreStateAccount": { "type": "object", "additionalproperties": true, @@ -297,27 +165,6 @@ } ] }, - "HexLen40": { - "pattern": "^0x[0-9a-fA-F]{40}$", - "type": "string" - }, - "HexNoPrefixLen40": { - "pattern": "^[0-9a-fA-F]{40}$", - "type": "string" - }, - "AddressMaybePrefixOrEmpty": { - "oneOf": [ - { - "$ref": "#/definitions/HexLen40" - }, - { - "$ref": "#/definitions/HexNoPrefixLen40" - }, - { - "$ref": "#/definitions/EmptyString" - } - ] - }, "Transaction": { "type": "object", "additionalProperties": true, @@ -415,43 +262,6 @@ "to", "value" ] - }, - "TransactionResults": { - "items": { - "additionalProperties": false, - "properties": { - "hash": { - "$ref": "#/definitions/HexData" - }, - "logs": {}, - "indexes": { - "additionalProperties": false, - "properties": { - "data": { - "type": "integer" - }, - "gas": { - "type": "integer" - }, - "value": { - "type": "integer" - } - }, - "required": [ - "data", - "gas", - "value" - ], - "type": "object" - } - }, - "required": [ - "hash", - "indexes" - ], - "type": "object" - }, - "type": "array" } }, "patternProperties": { diff --git a/JSONSchema/definitions.json b/JSONSchema/definitions.json new file mode 100644 index 000000000..9c9ca3d44 --- /dev/null +++ b/JSONSchema/definitions.json @@ -0,0 +1,200 @@ +{ + "definitions": { + "AddressMaybePrefixOrEmpty": { + "oneOf": [ + { + "$ref": "#/definitions/HexLen40" + }, + { + "$ref": "#/definitions/HexNoPrefixLen40" + }, + { + "$ref": "#/definitions/EmptyString" + } + ] + }, + "ConfusedHexType": { + "anyOf": [ + { + "$ref": "#/definitions/HexData" + }, + { + "$ref": "#/definitions/HexQuantity" + } + ] + }, + "EmptyString": { + "pattern": "^$", + "type": "string" + }, + "HexData": { + "description": "Hex data. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", + "pattern": "^0x([0-9a-fA-F][0-9a-fA-F])*$", + "type": "string" + }, + "HexDataOrEmpty": { + "oneOf": [ + { + "$ref": "#/definitions/HexData" + }, + { + "$ref": "#/definitions/EmptyString" + } + ] + }, + "HexLen40": { + "pattern": "^0x[0-9a-fA-F]{40}$", + "type": "string" + }, + "HexMaybePrefix": { + "oneOf": [ + { + "$ref": "#/definitions/HexNoPrefix" + }, + { + "$ref": "#/definitions/HexData" + } + ] + }, + "HexMaybePrefixOrEmpty": { + "oneOf": [ + { + "$ref": "#/definitions/HexMaybePrefix" + }, + { + "$ref": "#/definitions/EmptyString" + } + ] + }, + "HexNoPrefix": { + "pattern": "^([0-9a-fA-F][0-9a-fA-F])+$", + "type": "string" + }, + "HexNoPrefixLen40": { + "pattern": "^[0-9a-fA-F]{40}$", + "type": "string" + }, + "HexQuantity": { + "description": "Hex quantity. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", + "pattern": "(^0x0$)|(^0x[1-9a-fA-F][0-9a-fA-F]*$)", + "type": "string" + }, + "IntegerOrConfusedHex": { + "anyOf": [ + { + "$ref": "#/definitions/IntegerString" + }, + { + "$ref": "#/definitions/ConfusedHexType" + } + ] + }, + "IntegerOrEmpty": { + "oneOf": [ + { + "$ref": "#/definitions/IntegerString" + }, + { + "$ref": "#/definitions/EmptyString" + } + ] + }, + "IntegerOrEmptyOrConfusedHex": { + "oneOf": [ + { + "$ref": "#/definitions/IntegerOrEmpty" + }, + { + "$ref": "#/definitions/ConfusedHexType" + } + ] + }, + "IntegerOrEmptyOrHexQuantity": { + "oneOf": [ + { + "$ref": "#/definitions/IntegerOrEmpty" + }, + { + "$ref": "#/definitions/HexQuantity" + } + ] + }, + "IntegerOrHexQuantity": { + "oneOf": [ + { + "$ref": "#/definitions/IntegerString" + }, + { + "$ref": "#/definitions/HexQuantity" + } + ] + }, + "TransactionResults": { + "items": { + "additionalProperties": false, + "properties": { + "hash": { + "$ref": "#/definitions/HexData" + }, + "logs": {}, + "indexes": { + "additionalProperties": false, + "properties": { + "data": { + "type": "integer" + }, + "gas": { + "type": "integer" + }, + "value": { + "type": "integer" + } + }, + "required": [ + "data", + "gas", + "value" + ], + "type": "object" + } + }, + "required": [ + "hash", + "indexes" + ], + "type": "object" + }, + "type": "array" + }, + "PrefixedHexOrInteger": { + "anyOf": [ + { "$ref": "#/definitions/IntegerString" }, + { "$ref": "#/definitions/HexData" } + ] + }, + "IntegerOrNumber": { + "oneOf": [ + { + "$ref": "#/definitions/IntegerString" + }, + { + "type": "number" + } + ] + }, + "IntegerOrNumberOrConfusedHex": { + "oneOf": [ + { + "$ref": "#/definitions/IntegerOrNumber" + }, + { + "$ref": "#/definitions/ConfusedHexType" + } + ] + }, + "IntegerString": { + "pattern": "^[0-9]+$", + "type": "string" + } + } +} diff --git a/JSONSchema/st-filler-schema.json b/JSONSchema/st-filler-schema.json index d110e0493..aeb828912 100644 --- a/JSONSchema/st-filler-schema.json +++ b/JSONSchema/st-filler-schema.json @@ -1,25 +1,5 @@ { "definitions": { - "EmptyString": { - "type": "string", - "pattern": "^$" - }, - "HexData": { - "description": "Hex data. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", - "pattern": "^0x([0-9a-fA-F][0-9a-fA-F])*$", - "type": "string" - }, - "HexQuantity": { - "description": "Hex quantity. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", - "pattern": "(^0x0$)|(^0x[1-9a-fA-F][0-9a-fA-F]*$)", - "type": "string" - }, - "ConfusedHexType": { - "anyOf": [ - { "$ref": "#/definitions/HexData" }, - { "$ref": "#/definitions/HexQuantity" } - ] - }, "TxData": { "oneOf": [ { "$ref": "#/definitions/HexData" }, @@ -31,74 +11,6 @@ "type" : "string", "pattern" : "^{.*}$" }, - "HexNoPrefix" : { - "pattern": "^([0-9a-fA-F][0-9a-fA-F])+$", - "type": "string" - }, - "HexMaybePrefix": { - "oneOf": [ - { "$ref": "#/definitions/HexNoPrefix" }, - { "$ref": "#/definitions/HexData" } - ] - }, - "HexMaybePrefixOrEmpty": { - "oneOf": [ - { "$ref": "#/definitions/HexMaybePrefix" }, - { "$ref": "#/definitions/EmptyString" } - ] - }, - "IntegerString": { - "pattern": "^[0-9]+$", - "type": "string" - }, - "IntegerOrEmpty": { - "oneOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "$ref": "#/definitions/EmptyString" } - ] - }, - "IntegerOrNumber": { - "oneOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "type": "number" } - ] - }, - "IntegerOrNumberOrConfusedHex": { - "oneOf": [ - { "$ref": "#/definitions/IntegerOrNumber" }, - { "$ref": "#/definitions/ConfusedHexType" } - ] - }, - "IntegerOrEmptyOrHexQuantity": { - "oneOf": [ - { "$ref": "#/definitions/IntegerOrEmpty" }, - { "$ref": "#/definitions/HexQuantity" } - ] - }, - "IntegerOrHexQuantity": { - "oneOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "$ref": "#/definitions/HexQuantity" } - ] - }, - "IntegerOrConfusedHex": { - "anyOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "$ref": "#/definitions/ConfusedHexType" } - ] - }, - "IntegerOrEmptyOrConfusedHex": { - "oneOf": [ - { "$ref": "#/definitions/IntegerOrEmpty" }, - { "$ref": "#/definitions/ConfusedHexType" } - ] - }, - "PrefixedHexOrInteger": { - "anyOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "$ref": "#/definitions/HexData" } - ] - }, "PreStateAccount": { "type": "object", "additionalproperties": true, @@ -147,21 +59,6 @@ { "enum" : [ "0", "1" ] } ] }, - "HexLen40": { - "pattern": "^0x[0-9a-fA-F]{40}$", - "type": "string" - }, - "HexNoPrefixLen40": { - "pattern": "^[0-9a-fA-F]{40}$", - "type": "string" - }, - "AddressMaybePrefixOrEmpty" : { - "oneOf": [ - { "$ref": "#/definitions/HexLen40" }, - { "$ref": "#/definitions/HexNoPrefixLen40" }, - { "$ref": "#/definitions/EmptyString" } - ] - }, "Transaction": { "type": "object", "additionalProperties": true, diff --git a/JSONSchema/st-schema.json b/JSONSchema/st-schema.json index 7b1536dae..44411ae71 100644 --- a/JSONSchema/st-schema.json +++ b/JSONSchema/st-schema.json @@ -1,93 +1,5 @@ { "definitions": { - "EmptyString": { - "type": "string", - "pattern": "^$" - }, - "HexData": { - "description": "Hex data. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", - "pattern": "^0x([0-9a-fA-F][0-9a-fA-F])*$", - "type": "string" - }, - "HexQuantity": { - "description": "Hex quantity. see https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding", - "pattern": "(^0x0$)|(^0x[1-9a-fA-F][0-9a-fA-F]*$)", - "type": "string" - }, - "ConfusedHexType": { - "anyOf": [ - { "$ref": "#/definitions/HexData" }, - { "$ref": "#/definitions/HexQuantity" } - ] - }, - "HexDataOrEmpty": { - "oneOf": [ - { "$ref": "#/definitions/HexData" }, - { "$ref": "#/definitions/EmptyString" } - ] - }, - "HexNoPrefix" : { - "pattern": "^([0-9a-fA-F][0-9a-fA-F])+$", - "type": "string" - }, - "HexMaybePrefix": { - "oneOf": [ - { "$ref": "#/definitions/HexNoPrefix" }, - { "$ref": "#/definitions/HexData" } - ] - }, - "HexMaybePrefixOrEmpty": { - "oneOf": [ - { "$ref": "#/definitions/HexMaybePrefix" }, - { "$ref": "#/definitions/EmptyString" } - ] - }, - "IntegerString": { - "pattern": "^[0-9]+$", - "type": "string" - }, - "IntegerOrEmpty": { - "oneOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "$ref": "#/definitions/EmptyString" } - ] - }, - "IntegerOrNumber": { - "oneOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "type": "number" } - ] - }, - "IntegerOrNumberOrConfusedHex": { - "oneOf": [ - { "$ref": "#/definitions/IntegerOrNumber" }, - { "$ref": "#/definitions/ConfusedHexType" } - ] - }, - "IntegerOrEmptyOrHexQuantity": { - "oneOf": [ - { "$ref": "#/definitions/IntegerOrEmpty" }, - { "$ref": "#/definitions/HexQuantity" } - ] - }, - "IntegerOrHexQuantity": { - "oneOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "$ref": "#/definitions/HexQuantity" } - ] - }, - "IntegerOrConfusedHex": { - "anyOf": [ - { "$ref": "#/definitions/IntegerString" }, - { "$ref": "#/definitions/ConfusedHexType" } - ] - }, - "IntegerOrEmptyOrConfusedHex": { - "oneOf": [ - { "$ref": "#/definitions/IntegerOrEmpty" }, - { "$ref": "#/definitions/ConfusedHexType" } - ] - }, "PreStateAccount": { "type": "object", "additionalproperties": true, @@ -128,21 +40,6 @@ { "enum" : [ "0x00", "0x01" ] } ] }, - "HexLen40": { - "pattern": "^0x[0-9a-fA-F]{40}$", - "type": "string" - }, - "HexNoPrefixLen40": { - "pattern": "^[0-9a-fA-F]{40}$", - "type": "string" - }, - "AddressMaybePrefixOrEmpty" : { - "oneOf": [ - { "$ref": "#/definitions/HexLen40" }, - { "$ref": "#/definitions/HexNoPrefixLen40" }, - { "$ref": "#/definitions/EmptyString" } - ] - }, "Transaction": { "type": "object", "additionalProperties": true, @@ -214,43 +111,6 @@ "to", "value" ] - }, - "TransactionResults": { - "items": { - "additionalProperties": false, - "properties": { - "hash": { - "$ref": "#/definitions/HexData" - }, - "logs": {}, - "indexes": { - "additionalProperties": false, - "properties": { - "data": { - "type": "integer" - }, - "gas": { - "type": "integer" - }, - "value": { - "type": "integer" - } - }, - "required": [ - "data", - "gas", - "value" - ], - "type": "object" - } - }, - "required": [ - "hash", - "indexes" - ], - "type": "object" - }, - "type": "array" } }, "patternProperties": { |