Skip to content

Commit

Permalink
warn on missing events
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Jan 15, 2025
1 parent de9f6d6 commit c876302
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dipdup/codegen/substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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': ''})
Expand All @@ -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)

Expand Down

0 comments on commit c876302

Please sign in to comment.