Hi Team, I have a json response which contains an ...
# pact-jvm
h
Hi Team, I have a json response which contains an array object and I am trying to validate it using
eachLike
, but once the interaction.json file is created, it shows the entire response inside of that array object.
r
Can you provide your test code to show what you are doing?
h
@rholshausen
Copy code
PactDslJsonBody body = new PactDslJsonBody()
        .stringType("id")
        .stringType("summary")
        .eachLike("arrayData")
            .stringType("id")
            .stringType("formatCode")
        .booleanType("Price")
        .booleanType("permissionsAvailable")
the contract file considers even the
booleanType
parameters as a part of
arrayData
object, which they are not.
r
You're missing a
.closeArray()
after
.stringType("formatCode")
h
when I add
.closeArray()
, intellij starts throwing error from the next line, i.e.
booleanType("Price")
h
can you share the link of the api response for which this is written?
u
Sorry, no
We don't have an api response for that
h
okay, I am struggling a bit to write consumer test for a response containing an array, not sure exactly which matcher to use.