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
commit 7ddba51b36

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;
}