Generate empty objects and arrays for non required object and array fields
This commit is contained in:
parent
50131c6960
commit
7ddba51b36
1 changed files with 16 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue