Skip to content

Commit 90447f9

Browse files
hyanwongmergify[bot]
authored andcommitted
Allow no properties
see #694 (comment)
1 parent 566ab42 commit 90447f9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tsinfer/inference.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@
7373

7474
def add_to_schema(schema, name, definition=None, required=False):
7575
schema = copy.deepcopy(schema)
76-
if name in schema["properties"]:
77-
raise ValueError(f"The metadata {name} is reserved for use by tsinfer")
7876
if definition is None:
7977
definition = {}
78+
try:
79+
if name in schema["properties"]:
80+
raise ValueError(f"The metadata {name} is reserved for use by tsinfer")
81+
except KeyError:
82+
schema["properties"] = {}
8083
schema["properties"][name] = definition
8184
if required:
8285
schema["required"].append(name)

0 commit comments

Comments
 (0)