Update client/src/utils/schemaUtils.ts

Co-authored-by: Cliff Hall <cliff@futurescale.com>
This commit is contained in:
Ola Hungerford 2025-06-10 21:21:51 -07:00 • committed by GitHub
commit cf2778ad19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,13 +113,13 @@ export function generateDefaultValue(
const obj: JsonObject = {};
// Only include properties that are required according to the schema's required array
Object.entries(schema.properties).forEach(([key, prop]) => {
const isPropertyRequired = schema.required?.includes(key) ?? false;
if (isPropertyRequired) {
if (isPropertyRequired(key, schema)) {
const value = generateDefaultValue(prop, key, schema);
if (value !== undefined) {
obj[key] = value;
}
}
});
return obj;
}