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:
parent
316906aeb8
commit
7655eeb51c
1 changed files with 33 additions and 8 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue