diff --git a/duniterpy/api/gva/schema.qraphql b/duniterpy/api/gva/schema.qraphql new file mode 100644 index 0000000000000000000000000000000000000000..558e8ad44d9b2e13763fe62323c656dd8031d90c --- /dev/null +++ b/duniterpy/api/gva/schema.qraphql @@ -0,0 +1,29 @@ +schema { + query: Query +} + +type Query { + node: Node +} + +type Node { + summary: Summary + sandboxes: Sandboxes +} + +type Summary { + software: String! + version: String! + forkWindowSize: Int! +} + +type Sandbox { + size: Int! + free: Int! +} + +type Sandboxes { + identities: Sandbox! + memberships: Sandbox! + transactions: Sandbox! +} diff --git a/examples/request_swapi.py b/examples/request_swapi.py index 4322ac6e23358514af41665a9f2cf9cefdeb19f4..b60aa14266113d70a77767730d0c2c6a25c82a9d 100644 --- a/examples/request_swapi.py +++ b/examples/request_swapi.py @@ -1,4 +1,7 @@ import asyncio +import os + +import graphql from duniterpy.api.client import Client @@ -14,6 +17,13 @@ SWAPI_ENDPOINT = "BMAS swapi.graph.cool 443" async def main(): + + # validate duniter GVA graphql schema + with open(os.path.join(os.path.dirname(__file__), '../duniterpy/api/gva/schema.qraphql'), 'r') as fd: + document = graphql.parse(fd.read()) + schema = graphql.build_ast_schema(document) + print(schema) + client = Client(SWAPI_ENDPOINT) query = """query {