Forum Discussion

ryancabanas's avatar
ryancabanas
Occasional Visitor
6 months ago

Possible to define an array of 2 different objects and REQUIRE both objects be present?

Hi,

I want to accomplish something like this:

{
"array": [
{
"property1": ["strings"]
},
{
"property2": ["strings"]
}
]
}

It's REQUIRED that BOTH objects be present in the array.  One with "property1" and the other with "property2".  I read the examples shown here for the options "oneOf", "anyOf", "allOf", but I'm not sure if any of them fit exactly what I need?  I understand that "anyOf" can ALLOW both objects to be present at the same time, but I need to REQUIRE that both objects be present at the same time.

Any way to accomplish what I'm after?

Thanks!

No RepliesBe the first to reply