Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Added more methods to validate json #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import os

schema_path = f'{os.path.dirname(__file__)}/schemas'
schema_path = os.path.join(os.path.dirname(__file__), 'schemas')
224 changes: 53 additions & 171 deletions api/schemas/debug_traceBlockByNumber.json
Original file line number Diff line number Diff line change
@@ -1,175 +1,57 @@
{
"$schema": "https://json-schema.org/schema",
"$id": "http://example.com/example.json",
"type": "object",
"default": {},
"title": "Root Schema",
"required": [
"jsonrpc",
"id",
"result"
],
"properties": {
"jsonrpc": {
"type": "string",
"default": "",
"title": "The jsonrpc Schema",
"examples": [
"2.0"
]
},
"id": {
"type": [
"integer",
"string"
],
"default": 0,
"title": "The id Schema",
"examples": [
1
]
},
"result": {
"type": "array",
"default": [],
"title": "The result Schema",
"items": {
"type": "object",
"default": {},
"title": "A Schema",
"required": [
"type",
"from",
"to",
"value",
"gas",
"gasUsed",
"input",
"output",
"time"
],
"properties": {
"type": {
"type": "string",
"default": "",
"title": "The type Schema",
"examples": [
"CALL"
]
},
"from": {
"type": "string",
"default": "",
"title": "The from Schema",
"examples": [
"0x67b1d87101671b127f5f8714789c7192f7ad340e"
]
},
"to": {
"type": "string",
"default": "",
"title": "The to Schema",
"examples": [
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
]
},
"value": {
"type": "string",
"default": "",
"title": "The value Schema",
"examples": [
"0x470de4df820000"
]
},
"gas": {
"type": "string",
"default": "",
"title": "The gas Schema",
"examples": [
"0x0"
]
},
"gasUsed": {
"type": "string",
"default": "",
"title": "The gasUsed Schema",
"examples": [
"0x0"
]
},
"input": {
"type": "string",
"default": "",
"title": "The input Schema",
"examples": [
"0x"
]
},
"output": {
"type": "string",
"default": "",
"title": "The output Schema",
"examples": [
"0x"
]
},
"time": {
"type": "string",
"default": "",
"title": "The time Schema",
"examples": [
"2.707µs"
]
}
"$schema": "http://json-schema.org/schema#",
"properties": {
"id": {
"type": "string"
},
"examples": [
{
"type": "CALL",
"from": "0x67b1d87101671b127f5f8714789c7192f7ad340e",
"to": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value": "0x470de4df820000",
"gas": "0x0",
"gasUsed": "0x0",
"input": "0x",
"output": "0x",
"time": "2.707µs"
}
]
},
"examples": [
[
{
"type": "CALL",
"from": "0x67b1d87101671b127f5f8714789c7192f7ad340e",
"to": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value": "0x470de4df820000",
"gas": "0x0",
"gasUsed": "0x0",
"input": "0x",
"output": "0x",
"time": "2.707µs"
}
]
]
}
},
"examples": [
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"type": "CALL",
"from": "0x67b1d87101671b127f5f8714789c7192f7ad340e",
"to": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value": "0x470de4df820000",
"gas": "0x0",
"gasUsed": "0x0",
"input": "0x",
"output": "0x",
"time": "2.707µs"
"jsonrpc": {
"type": "string"
},
"result": {
"items": {
"properties": {
"result": {
"properties": {
"from": {
"type": "string"
},
"gas": {
"type": "string"
},
"gasUsed": {
"type": "string"
},
"input": {
"type": "string"
},
"output": {
"type": "string"
},
"to": {
"type": "string"
},
"type": {
"type": "string"
},
"value": {
"type": "string"
}
},
"type": "object"
}
},
"required": [
"result"
],
"type": "object"
},
"type": "array"
}
]
}
]
},
"required": [
"id",
"jsonrpc",
"result"
],
"type": "object"
}
44 changes: 44 additions & 0 deletions api/schemas/erigon_blockNumber.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://json-schema.org/schema",
"$id": "http://example.com/example.json",
"type": "object",
"default": {},
"title": "Root Schema",
"required": [
"id",
"jsonrpc",
"result"
],
"properties": {
"id": {
"type": "string",
"default": "",
"title": "The id Schema",
"examples": [
"0x4d"
]
},
"jsonrpc": {
"type": "string",
"default": "",
"title": "The jsonrpc Schema",
"examples": [
"2.0"
]
},
"result": {
"type": "string",
"default": "",
"title": "The result Schema",
"examples": [
"0x6"
],
"minLength": 3
}
},
"examples": [{
"id": "0x4d",
"jsonrpc": "2.0",
"result": "0x6"
}]
}
88 changes: 88 additions & 0 deletions api/schemas/erigon_forks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"$schema": "https://json-schema.org/schema",
"$id": "http://example.com/example.json",
"type": "object",
"default": {},
"title": "Root Schema",
"required": [
"id",
"jsonrpc",
"result"
],
"properties": {
"id": {
"type": "string",
"default": "",
"title": "The id Schema",
"examples": [
"0x4d"
]
},
"jsonrpc": {
"type": "string",
"default": "",
"title": "The jsonrpc Schema",
"examples": [
"2.0"
]
},
"result": {
"type": "object",
"default": {},
"title": "The result Schema",
"required": [
"genesis"
],
"properties": {
"forks": {
"type": "array",
"default": [],
"title": "The forks Schema",
"items": {},
"examples": [
[]
]
},
"genesis": {
"type": "string",
"default": "",
"title": "The genesis Schema",
"examples": [
"0xc493151b4991dd1bf459952509bba9bc3fb2b706299e18e36e6b78781835065d"
]
},
"heightForks": {
"type": "array",
"default": [],
"title": "The heightForks Schema",
"items": {},
"examples": [
[]
]
},
"timeForks": {
"type": "null",
"default": "",
"title": "The timeForks Schema",
"examples": [
null
]
}
},
"examples": [{
"forks": [],
"genesis": "0xc493151b4991dd1bf459952509bba9bc3fb2b706299e18e36e6b78781835065d"
}]
}
},
"examples": [{
"id": "0x4d",
"jsonrpc": "2.0",
"result": {
"forks": [],
"genesis": "0xc493151b4991dd1bf459952509bba9bc3fb2b706299e18e36e6b78781835065d",
"heightForks": [],
"timeForks":null
}
}]
}
Loading