Skip to content

Commit

Permalink
Fix issue with schema validation
Browse files Browse the repository at this point in the history
Ignoring non-JSON lines
  • Loading branch information
rw-bsi authored Aug 17, 2024
1 parent 3e50334 commit 6f26b4b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/apps/ifc_validation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,15 @@ def schema_validation_subtask(self, prev_result, id, file_name, *args, **kwargs)
task.mark_as_failed(err)
raise

output = list(filter(None, proc.stdout.split("\n")))
# schema check returns either multiple JSON lines, or a single line message, or nothing.
def is_schema_error(line):
try:
json.loads(line) # ignoring non-JSON messages
except ValueError:
return False
return True

output = list(filter(is_schema_error, proc.stdout.split("\n")))
# success = (len(output) == 0)
# tfk: if we mark this task as failed we don't do the instance population either.
# marking as failed should probably be reserved for blocking errors (prerequisites)
Expand Down

0 comments on commit 6f26b4b

Please sign in to comment.