Use case
A checkout flow wheredelivery_method decides which contact details are mandatory. When the user wants email delivery, you need their email address. When they want SMS, you need their phone number. Both should never be required simultaneously.
Schema pattern
Prompt snippet
Example outputs
Why this works
TheanyOf branches split the payload into two exact shapes. The email branch requires email, and the SMS branch requires phone. Because delivery_method is fixed with const in each branch, the model cannot mix fields across branches, so anyOf is equivalent to oneOf here.