Erich Zimmerman
09/15/2025, 11:41 PM{
"destinations": [],
"cities": [],
"airports": [
{
"code": "MSY",
"name": "Louis Armstrong New Orleans International Airport"
}
]
}
I want to match that "destinations" and "cities" are indeed empty lists.
I am trying to use maxArrayLike("destinations", 0, example) but I get an error on the Consumer test complaining that I either cannot leave that field empty, or that the example of 1 doesn't match the expected size of 0.
Slack Conversationrholshausen
09/15/2025, 11:56 PMrholshausen
09/15/2025, 11:57 PMErich Zimmerman
09/16/2025, 12:09 AMrholshausen
09/16/2025, 12:13 AMrholshausen
09/16/2025, 12:14 AMErich Zimmerman
09/19/2025, 12:22 AMcities: [ ]
destinations: [ ]
in the pact file, which is completely reasonable.
But I'm not clear how to specify that in the Java DSL code (your statement: "just provide an empty array for the attribute"). Using maxArrayLike does result in that output, but I would love a way that makes more sense.
Bing tells me that it is straightforward to match an array that has 0 or more values, but I specifically want 0.rholshausen
09/19/2025, 12:30 AMPactDslJsonArray (it should work in theory), but you have a working example.rholshausen
09/19/2025, 12:31 AMbody.array("cities").closeArray()Erich Zimmerman
09/22/2025, 4:43 PMarray("cities") would match an array of any size. That is much cleaner than the maxArrayLike syntax. Thanks!!rholshausen
09/22/2025, 11:00 PMbody.emptyArray("cities")
would be even better