diff --git a/src/erc7730/lint/lint.py b/src/erc7730/lint/lint.py index 540266d..71be886 100644 --- a/src/erc7730/lint/lint.py +++ b/src/erc7730/lint/lint.py @@ -82,7 +82,10 @@ def lint_file(path: Path, linter: ERC7730Linter, out: OutputAdder) -> None: except ValidationError as e: for ex in e.errors(include_url=False, include_context=True, include_input=True): loc = ex["loc"] - adder.error(title=f"{loc} is invalid", message=ex["msg"]) + if loc == (): + adder.error(title="Validation error", message=str(ex)) + else: + adder.error(title=f"{loc} is invalid", message=ex["msg"]) except Exception as e: # TODO unwrap pydantic validation errors here to provide more user-friendly error messages adder.error(title="Failed to parse descriptor", message=str(e)) diff --git a/tests/model/test_model_serialization.py b/tests/model/test_model_serialization.py index 64a409e..fe5f86e 100644 --- a/tests/model/test_model_serialization.py +++ b/tests/model/test_model_serialization.py @@ -20,6 +20,9 @@ def test_schema(input_file: Path) -> None: """Test model serializes to JSON that matches the schema.""" assert_valid_erc_7730(InputERC7730Descriptor.load(input_file)) +def test_poap() -> None: + """Test model serializes to JSON that matches the schema.""" + InputERC7730Descriptor.load(Path("/home/jnicoulaud/work/ledger/backend/cal/python-erc7730/python-erc7730-1/tests/registries/clear-signing-erc7730-registry/registry/poap/calldata-PoapBridge.json")) @pytest.mark.parametrize("input_file", ERC7730_DESCRIPTORS, ids=path_id) def test_round_trip(input_file: Path) -> None: