Remove type dependency on @cfworker/json-schema (#1229)

Co-authored-by: Matt Carey <mcarey@cloudflare.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
This commit is contained in:
Luca Chang 2025-12-05 09:13:45 -08:00 • committed by GitHub
commit 7655eeb51c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -93,14 +93,20 @@ function applyElicitationDefaults(schema: JsonSchemaType | undefined, data: unkn
if (Array.isArray(schema.anyOf)) {
for (const sub of schema.anyOf) {
applyElicitationDefaults(sub, data);
// Skip boolean schemas (true/false are valid JSON Schemas but have no defaults)
if (typeof sub !== 'boolean') {
applyElicitationDefaults(sub, data);
}
}
}
// Combine schemas
if (Array.isArray(schema.oneOf)) {
for (const sub of schema.oneOf) {
applyElicitationDefaults(sub, data);
// Skip boolean schemas (true/false are valid JSON Schemas but have no defaults)
if (typeof sub !== 'boolean') {
applyElicitationDefaults(sub, data);
}
}
}
}