in jobs/socorro_import_crash_data.py [0:0]
def replace_definitions(schema, definitions):
"""Replace references in the JSON schema with their definitions."""
if "properties" in schema:
for _, meta in schema["properties"].items():
replace_definitions(meta, definitions)
elif "items" in schema:
if "$ref" in schema["items"]:
ref = schema["items"]["$ref"].split("/")[-1]
schema["items"] = definitions[ref]
replace_definitions(schema["items"], definitions)
else:
replace_definitions(schema["items"], definitions)
elif "$ref" in str(schema):
err_msg = f"Reference not found for schema: {schema!s}"
log.error(err_msg)
raise ValueError(err_msg)