Update client/src/utils/schemaUtils.ts
Co-authored-by: Cliff Hall <cliff@futurescale.com>
This commit is contained in:
parent
51eb7cf849
commit
cf2778ad19
1 changed files with 2 additions and 2 deletions
|
|
@ -113,13 +113,13 @@ export function generateDefaultValue(
|
||||||
const obj: JsonObject = {};
|
const obj: JsonObject = {};
|
||||||
// Only include properties that are required according to the schema's required array
|
// Only include properties that are required according to the schema's required array
|
||||||
Object.entries(schema.properties).forEach(([key, prop]) => {
|
Object.entries(schema.properties).forEach(([key, prop]) => {
|
||||||
const isPropertyRequired = schema.required?.includes(key) ?? false;
|
if (isPropertyRequired(key, schema)) {
|
||||||
if (isPropertyRequired) {
|
|
||||||
const value = generateDefaultValue(prop, key, schema);
|
const value = generateDefaultValue(prop, key, schema);
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
obj[key] = value;
|
obj[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue