Generate empty objects and arrays for non required object and array fields
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user