Generate empty objects and arrays for non required object and array fields

This commit is contained in:
Ola Hungerford
2025-03-17 06:36:35 -07:00
parent 50131c6960
commit 7ddba51b36
2 changed files with 16 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ export function generateDefaultValue(schema: JsonSchemaType): JsonValue {
}
if (!schema.required) {
if (schema.type === "array") return [];
if (schema.type === "object") return {};
return null;
}