import json path = "fixtures/database.json" with open(path, "r") as f: data = json.load(f) test_case = data[-1] # Get full.person object properties props = test_case["database"]["types"][0]["schemas"]["full.person"]["properties"] # Find extended_relations target and add properties! target_ref = props["extended_relations"]["items"]["properties"]["target"] target_ref["properties"] = { "extra_3rd_level": {"type": "string"} } # The target is now an ad-hoc composition itself! # We expect `full.person/extended_relations/target` to be globally promoted. test_case["tests"][0]["expect"]["schemas"] = [ "full.contact", "full.person", "full.person/ad_hoc_bubble", "full.person/extended_relations", "full.person/extended_relations/target", # BOOM! Right here, 3 levels deep! "light.email_address", "some_bubble", "student.person" ] with open(path, "w") as f: json.dump(data, f, indent=2)