From 7f70936396aedbc16ac46b37e41508c628ce1b2e Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Tue, 26 Mar 2024 15:52:18 +1100 Subject: [PATCH] feat(consumer-dsl): Support object and array expectation without specifying consumer in LambdaDSL #1737 --- .../pact/consumer/dsl/LambdaDslObject.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/consumer/src/main/java/au/com/dius/pact/consumer/dsl/LambdaDslObject.java b/consumer/src/main/java/au/com/dius/pact/consumer/dsl/LambdaDslObject.java index 9f9e4b41f4..6abd1f16e9 100644 --- a/consumer/src/main/java/au/com/dius/pact/consumer/dsl/LambdaDslObject.java +++ b/consumer/src/main/java/au/com/dius/pact/consumer/dsl/LambdaDslObject.java @@ -579,6 +579,17 @@ public LambdaDslObject array(final String name, final Consumer return this; } + /** + * Attribute that is a JSON object. This will accept any JSON object, including an empty one. If you need to + * configure the object, use the method that takes a consumer. + * + * @param name field name + */ + public LambdaDslObject object(final String name) { + object.object(name).closeObject(); + return this; + } + /** * Attribute that is an array where each item must match the following example *