Skip to content

Commit

Permalink
#2300: scripts: validate edges in single file
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Jul 11, 2024
1 parent 1b87599 commit 2f42cab
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripts/JSON_data_files_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,18 @@ def __validate_file(file_path, validate_comm_links):
else:
logging.warning(f"Schema type not found in file: {file_path}. \nPassing by default when schema type not found.")

if validate_comm_links:
logging.info("FIXME: comm_links validation not implemented.")
if validate_comm_links and schema_type == "LBDatafile":
JSONDataFilesValidator.__validate_comm_links(json_data)

@staticmethod
def __validate_comm_links(data):
for phase in data["phases"]:
comm_ids = {int(comm["from"]["id"]) for comm in phase["communications"]}
comm_ids.update({int(comm["to"]["id"]) for comm in phase["communications"]})
task_ids = {int(task["entity"]["id"]) for task in phase["tasks"]}

if not comm_ids.issubset(task_ids):
logging.error(f" Phase {phase["id"]}: tasks {comm_ids - task_ids} were referenced in communication, but were not found.")

def main(self):
if self.__file_path is not None:
Expand Down

0 comments on commit 2f42cab

Please sign in to comment.