fix schema required added multiple times
This commit is contained in:
@@ -65,7 +65,9 @@
|
||||
} else {
|
||||
schema.properties[modalProperty.name] = modalToSchema(modalProperty)
|
||||
if (modalProperty.required) {
|
||||
schema.required = [...schema.required, modalProperty.name]
|
||||
if (!schema.required.includes(modalProperty.name)) {
|
||||
schema.required.push(modalProperty.name)
|
||||
}
|
||||
} else if (schema.required.includes(modalProperty.name)) {
|
||||
const index = schema.required.indexOf(modalProperty.name, 0)
|
||||
if (index > -1) {
|
||||
|
||||
@@ -37,7 +37,7 @@ export async function inferArgs(
|
||||
argSigToJsonSchemaType(arg.typ, schema.properties[arg.name])
|
||||
schema.properties[arg.name].default = arg.default
|
||||
|
||||
if (!arg.has_default) {
|
||||
if (!arg.has_default && !schema.required.includes(arg.name)) {
|
||||
schema.required.push(arg.name)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user