remondis-it / pact-consumer-builder

Library for generating pact consumer expectations from java beans
Apache License 2.0
14 stars 6 forks source link

Workaround // Top-level array/list in Pact Consumer #10

Closed schuettec closed 4 years ago

schuettec commented 4 years ago

If you try to generate a Pact Consumer for an endpoint that uses a top-level list in the json payload the following workaround must be used

PactDslJsonBody pactDslJsonBody = PactDslJsonArray.arrayMinLike(1);
pactDslJsonBody = ConsumerExpects.type(YOUR_BEAN_HERE.class)
    .build(pactDslJsonBody, YOUR_SAMPLE_OBJECT_HERE);

This library should and will provide a more comfortable way in the future, to solve this.