Skip to content

Commit c2f0860

Browse files
committed
Merge remote-tracking branch 'origin/main' into deps
2 parents 6e23bfe + 0819de9 commit c2f0860

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/parse-procedure.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,10 @@ function handleMergedSchema(mergedSchema: JSONSchema7): Result<ParsedProcedure>
186186
// zod-to-json-schema turns `z.string().optional()` into `{"anyOf":[{"not":{}},{"type":"string"}]}`
187187
function isOptional(schema: JSONSchema7Definition) {
188188
if (schema && typeof schema === 'object' && 'optional' in schema) return schema.optional === true
189+
if (schemaDefPropValue(schema, 'not') && JSON.stringify(schema) === '{"not":{}}') return true
189190
const anyOf = schemaDefPropValue(schema, 'anyOf')
190-
if (anyOf?.length === 2 && JSON.stringify(anyOf[0]) === '{"not":{}}') return true
191191
if (anyOf?.some(sub => isOptional(sub))) return true
192+
if (schemaDefPropValue(schema, 'default') !== undefined) return true
192193
return false
193194
}
194195

0 commit comments

Comments
 (0)