Skip to content

Commit 3483545

Browse files
authored
fix example generation for oneOf (#1512)
1 parent f9f7feb commit 3483545

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.generator/src/generator/formatter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,11 @@ def format_data_with_schema_dict(
350350

351351
parameters = ""
352352
if "properties" in schema:
353+
required_properties = set(schema.get("required", []))
354+
missing = required_properties - set(data.keys())
355+
if missing:
356+
raise ValueError(f"missing required properties: {missing}")
357+
353358
for k, v in data.items():
354359
if k in schema["properties"]:
355360
sub_schema = schema["properties"][k]

0 commit comments

Comments
 (0)