Skip to content

Commit d6966d9

Browse files
committed
chore(v2-matching-engine): Also check the child elements if there is a type matcher on an XML element
1 parent cfc5e44 commit d6966d9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • rust/pact_matching/src/engine/bodies

rust/pact_matching/src/engine/bodies/xml.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ impl XMLPlanBuilder {
7878
) {
7979
let children = group_children(element);
8080

81-
if !context.config.allow_unexpected_entries {
81+
let no_markers = remove_marker(&path);
82+
let no_indices = drop_indices(&no_markers);
83+
let matchers = context.select_best_matcher_from(&no_markers, &no_indices)
84+
.filter(|matcher| matcher.is_type_matcher())
85+
.remove_duplicates();
86+
if !context.config.allow_unexpected_entries || !matchers.is_empty() {
8287
if element.child_elements().next().is_none() {
8388
parent_node.add(
8489
ExecutionPlanNode::action("expect:empty")

0 commit comments

Comments
 (0)