aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Wasinger <j-wasinger@hotmail.com>2017-07-14 04:59:31 +0800
committerUbuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal>2017-08-08 04:41:46 +0800
commit8b3777057118b3157772dbe1fe9fb3404ecbb4c1 (patch)
treef8d02ff4c8329c1b76fc4e43acdbc95eb4224a5e
parent2f1708cc2810d36c37d48d5413677dd5bd8d8406 (diff)
downloaddexon-tests-8b3777057118b3157772dbe1fe9fb3404ecbb4c1.tar
dexon-tests-8b3777057118b3157772dbe1fe9fb3404ecbb4c1.tar.gz
dexon-tests-8b3777057118b3157772dbe1fe9fb3404ecbb4c1.tar.bz2
dexon-tests-8b3777057118b3157772dbe1fe9fb3404ecbb4c1.tar.lz
dexon-tests-8b3777057118b3157772dbe1fe9fb3404ecbb4c1.tar.xz
dexon-tests-8b3777057118b3157772dbe1fe9fb3404ecbb4c1.tar.zst
dexon-tests-8b3777057118b3157772dbe1fe9fb3404ecbb4c1.zip
improve type checking.
-rw-r--r--JSONSchema/schema.json338
1 files changed, 190 insertions, 148 deletions
diff --git a/JSONSchema/schema.json b/JSONSchema/schema.json
index 2b45077cf..78004e0c3 100644
--- a/JSONSchema/schema.json
+++ b/JSONSchema/schema.json
@@ -1,185 +1,227 @@
{
- "type":"object",
- "patternProperties":{
- "^.*$":{
- "type":"object",
- "properties":{
- "post":{
- "type":"object",
- "properties":{
- "EIP150":{
- "$ref":"#/definitions/TransactionResults"
- },
- "EIP158":{
- "$ref":"#/definitions/TransactionResults"
- },
- "Frontier":{
- "$ref":"#/definitions/TransactionResults"
- },
- "Homestead":{
- "$ref":"#/definitions/TransactionResults"
- },
- "Metropolis":{
- "$ref":"#/definitions/TransactionResults"
+ "definitions": {
+ "GasAmount": {
+ "pattern": "(^0x[76543210][0-9a-f]{15}$)|(^0x[0-9a-f]{0,15}$)",
+ "type": "string"
+ },
+ "SecretKey": {
+ "pattern": "^0x[0-9a-f]{64}$",
+ "type": "string"
+ },
+ "TransactionResults": {
+ "items": {
+ "additionalProperties": false,
+ "properties": {
+ "hash": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
+ },
+ "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": {
+ "^.*$": {
+ "properties": {
+ "env": {
+ "additionalproperties": false,
+ "properties": {
+ "currentCoinbase": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
+ },
+ "currentDifficulty": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
+ },
+ "currentGasLimit": {
+ "$ref": "#/definitions/GasAmount"
+ },
+ "currentNumber": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
+ },
+ "currentTimestamp": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
+ },
+ "previousHash": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
}
},
- "additionalProperties": false
+ "required": [
+ "currentCoinbase",
+ "currentDifficulty",
+ "currentGasLimit",
+ "currentNumber",
+ "currentTimestamp",
+ "previousHash"
+ ],
+ "type": "object"
},
- "explanation":{
- "type":"string"
+ "explanation": {
+ "type": "string"
},
- "env":{
- "type":"object",
- "properties":{
- "currentCoinbase":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
- },
- "currentDifficulty":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
- },
- "currentGasLimit":{
- "$ref": "#/definitions/GasAmount"
+ "post": {
+ "additionalProperties": false,
+ "properties": {
+ "EIP150": {
+ "$ref": "#/definitions/TransactionResults"
},
- "currentNumber":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
+ "EIP158": {
+ "$ref": "#/definitions/TransactionResults"
},
- "currentTimestamp":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
+ "Frontier": {
+ "$ref": "#/definitions/TransactionResults"
},
- "previousHash":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
+ "Homestead": {
+ "$ref": "#/definitions/TransactionResults"
+ },
+ "Metropolis": {
+ "$ref": "#/definitions/TransactionResults"
}
},
- "required": ["currentCoinbase", "currentDifficulty", "currentGasLimit", "currentNumber", "currentTimestamp", "previousHash"],
- "additionalproperties":false
+ "type": "object"
},
- "pre":{
- "type":"object",
- "patternProperties":{
- "^0x[0-9a-f]*":{
- "type":"object",
- "properties":{
- "balance":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
+ "pre": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^0x[0-9a-f]*": {
+ "additionalproperties": false,
+ "properties": {
+ "balance": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
},
- "code":{
- "type":"string",
- "pattern":"^(0x[0-9a-f]*)?$"
+ "code": {
+ "pattern": "^(0x[0-9a-f]*)?$",
+ "type": "string"
},
- "nonce":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
+ "nonce": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
},
- "storage":{
- "type":"object"
+ "storage": {
+ "type": "object"
}
},
- "required": ["balance", "code", "nonce"],
- "additionalproperties": false
+ "required": [
+ "balance",
+ "code",
+ "nonce"
+ ],
+ "type": "object"
}
},
- "additionalProperties":false
+ "type": "object"
},
- "transaction":{
- "type":"object",
- "properties":{
- "data":{
- "type":"array",
- "items":{
- "type":"string",
- "pattern":"^(0x[0-9a-f]*)?$"
- }
- },
- "gasLimit":{
- "type":"array",
- "items":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
- }
- },
- "gasPrice":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
- },
- "nonce":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
+ "transaction": {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "items": {
+ "oneOf": [
+ {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
+ },
+ {
+ "pattern": "^$",
+ "type": "string"
+ }
+ ]
+ },
+ "type": "array"
},
- "secretKey":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
+ "gasLimit": {
+ "items": {
+ "$ref": "#/definitions/GasAmount"
+ },
+ "type": "array"
},
- "to":{
- "type": "string",
- "pattern":"^(0x([0-9a-f]*){10})?$"
+ "gasPrice": {
+ "$ref": "#/definitions/GasAmount"
},
- "value":{
- "type":"array",
- "items":{
- "type":"string",
- "pattern":"^0x[0-9a-f]*$"
- }
+ "nonce": {
+ "pattern": "^0x[0-9a-f]{1,4}$",
+ "type": "string"
},
"r": {
+ "pattern": "^0x[0-9a-f]{16}$",
"type": "string"
},
"s": {
+ "pattern": "^0x[0-9a-f]{16}$",
"type": "string"
},
+ "secretKey": {
+ "$ref": "#/definitions/SecretKey"
+ },
+ "to": {
+ "oneOf": [
+ {
+ "pattern": "^0x[0-9a-f]{1,10}$",
+ "type": "string"
+ },
+ {
+ "pattern": "",
+ "type": "string"
+ }
+ ]
+ },
"v": {
+ "pattern": "^0x[0-9a-f]{16}$",
"type": "string"
+ },
+ "value": {
+ "items": {
+ "pattern": "^0x[0-9a-f]*$",
+ "type": "string"
+ },
+ "type": "array"
}
},
- "required": ["data", "gasLimit", "gasPrice", "nonce", "secretKey", "to", "value"],
- "additionalProperties":false
+ "required": [
+ "data",
+ "gasLimit",
+ "gasPrice",
+ "nonce",
+ "secretKey",
+ "to",
+ "value"
+ ],
+ "type": "object"
}
- }
+ },
+ "type": "object"
}
},
- "definitions": {
- "TransactionResults": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "hash": {
- "type": "string",
- "pattern":"^0x[0-9a-f]*$"
- },
- "indexes": {
- "type": "object",
- "properties": {
- "data": {
- "type": "integer"
- },
- "gas": {
- "type": "integer"
- },
- "value": {
- "type": "integer"
- }
- },
- "required": ["data", "gas", "value"],
- "additionalProperties": false
- }
- },
- "required": ["hash", "indexes"],
- "additionalProperties": false
- }
- },
- "Address": {
- "type": "string",
- "pattern":"^(0x[0-9a-f]*)?$"
- },
- "GasAmount": {
- "type":"string",
- "pattern": "(^0x[76543210][0-9a-f]{15}$)|(^0x[0-9a-f]{0,15}$)"
- }
- }
+ "type": "object"
}