From c8763020a30341808ccdd7eca3c9e4a63121a22d Mon Sep 17 00:00:00 2001 From: Lev Gorodetskiy Date: Wed, 15 Jan 2025 17:17:32 -0300 Subject: [PATCH] warn on missing events --- src/dipdup/codegen/substrate.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dipdup/codegen/substrate.py b/src/dipdup/codegen/substrate.py index d5cc2d5f6..0174f9f95 100644 --- a/src/dipdup/codegen/substrate.py +++ b/src/dipdup/codegen/substrate.py @@ -15,6 +15,7 @@ from dipdup.datasources import Datasource from dipdup.datasources.substrate_node import SubstrateNodeDatasource from dipdup.datasources.substrate_subscan import SubstrateSubscanDatasource +from dipdup.exceptions import ConfigurationError from dipdup.package import DipDupPackage from dipdup.runtimes import SubstrateRuntime from dipdup.runtimes import extract_args_name @@ -181,6 +182,7 @@ async def generate_schemas(self) -> None: qualname = f'{module["name"]}.{event_item["name"]}' if qualname not in events: continue + target_events[runtime_name].remove(qualname) # FIXME: ignore when only docs changed? dump = orjson.dumps({**event_item, 'name': ''}) @@ -206,6 +208,11 @@ async def generate_schemas(self) -> None: write(schema_path, json_dumps(jsonschema)) + for runtime_name, events in target_events.items(): + if events: + msg = f'Runtime `{runtime_name}` misses following events: {', '.join(events)}' + raise ConfigurationError(msg) + async def _generate_types(self, force: bool = False) -> None: await super()._generate_types(force)