diff --git a/python/podio_schema_evolution.py b/python/podio_schema_evolution.py index 9dd1cd08f..fa4d39d2d 100755 --- a/python/podio_schema_evolution.py +++ b/python/podio_schema_evolution.py @@ -369,6 +369,12 @@ def heuristics(self): f"Forbidden schema change in '{vmc.klassname}': Added vector member '{vmc.member}'" ) + dropped_vecmems = [c for c in schema_changes if isinstance(c, DroppedVectorMember)] + for vmc in dropped_vecmems: + self.errors.append( + f"Forbidden schema change in '{vmc.klassname}': Added vector member '{vmc.member_name}'" + ) + # are the member changes actually supported/supportable? changed_members = [ change for change in schema_changes if isinstance(change, ChangedMember) diff --git a/tests/schema_evolution/detection/CMakeLists.txt b/tests/schema_evolution/detection/CMakeLists.txt index 63152e62b..419e6acb4 100644 --- a/tests/schema_evolution/detection/CMakeLists.txt +++ b/tests/schema_evolution/detection/CMakeLists.txt @@ -1,5 +1,6 @@ set(should_fail_cases vector_members:add_new + vector_members:add_additional ) set(should_succeed_cases diff --git a/tests/schema_evolution/detection/vector_members/dm_add_additional_new.yaml b/tests/schema_evolution/detection/vector_members/dm_add_additional_new.yaml new file mode 100644 index 000000000..3a44a979c --- /dev/null +++ b/tests/schema_evolution/detection/vector_members/dm_add_additional_new.yaml @@ -0,0 +1,9 @@ +schema_version: 2 + +datatypes: + DataTypeWithOneVectorMember: + Description: "Type for testing the addition of new VectorMembers" + Author: "Thomas Madlener" + VectorMembers: + - float f // a float + - int i // an additional float diff --git a/tests/schema_evolution/detection/vector_members/dm_add_additional_old.yaml b/tests/schema_evolution/detection/vector_members/dm_add_additional_old.yaml new file mode 100644 index 000000000..a1efd3963 --- /dev/null +++ b/tests/schema_evolution/detection/vector_members/dm_add_additional_old.yaml @@ -0,0 +1,8 @@ +schema_version: 1 + +datatypes: + DataTypeWithOneVectorMember: + Description: "Type for testing the addition of new VectorMembers" + Author: "Thomas Madlener" + VectorMembers: + - float f // a float diff --git a/tests/schema_evolution/detection/vector_members/dm_rm_one_new.yaml b/tests/schema_evolution/detection/vector_members/dm_rm_one_new.yaml new file mode 100644 index 000000000..a3ce70b8e --- /dev/null +++ b/tests/schema_evolution/detection/vector_members/dm_rm_one_new.yaml @@ -0,0 +1,8 @@ +schema_version: 2 + +datatypes: + DataTypeWithSomeVectorMember: + Description: "Type for testing the removal of one VectorMember" + Author: "Thomas Madlener" + VectorMembers: + - double d // some doubles never hurt diff --git a/tests/schema_evolution/detection/vector_members/dm_rm_one_old.yaml b/tests/schema_evolution/detection/vector_members/dm_rm_one_old.yaml new file mode 100644 index 000000000..370095485 --- /dev/null +++ b/tests/schema_evolution/detection/vector_members/dm_rm_one_old.yaml @@ -0,0 +1,9 @@ +schema_version: 1 + +datatypes: + DataTypeWithSomeVectorMember: + Description: "Type for testing the removal of one VectorMember" + Author: "Thomas Madlener" + VectorMembers: + - float f // a float + - double d // some doubles never hurt