@@ -278,7 +278,7 @@ func (i *Interaction) addJSONConstraintsFromPact(path string, matchingRules map[
278
278
case []interface {}:
279
279
// Create constraints for each element in the array. This allows matching rules to override them.
280
280
for j := range val {
281
- i .addJSONConstraintsFromPact (fmt .Sprintf ("%v[%v ]" , path , j ), matchingRules , val [j ])
281
+ i .addJSONConstraintsFromPact (fmt .Sprintf ("%s[%d ]" , path , j ), matchingRules , val [j ])
282
282
}
283
283
// Length constraint so that requests with additional elements at the end of the array will not match
284
284
i .AddConstraint (interactionConstraint {
@@ -345,26 +345,26 @@ func (i *Interaction) EvaluateConstraints(request requestDocument, interactions
345
345
i .mu .RLock ()
346
346
defer i .mu .RUnlock ()
347
347
for _ , constraint := range i .constraints {
348
- values := constraint .Values
348
+ expected := constraint .Values
349
349
if constraint .Source != "" {
350
350
var err error
351
- values , err = i .loadValuesFromSource (constraint , interactions )
351
+ expected , err = i .loadValuesFromSource (constraint , interactions )
352
352
if err != nil {
353
353
violations = append (violations , err .Error ())
354
354
result = false
355
355
continue
356
356
}
357
357
}
358
358
359
- val , err := jsonpath .Get (request .encodeValues (constraint .Path ), map [string ]interface {}(request ))
359
+ actual , err := jsonpath .Get (request .encodeValues (constraint .Path ), map [string ]interface {}(request ))
360
360
if err != nil {
361
361
violations = append (violations ,
362
362
fmt .Sprintf ("constraint path %q cannot be resolved within request: %q" , constraint .Path , err ))
363
363
result = false
364
364
continue
365
365
}
366
366
367
- if err := constraint .Check ( values , val ); err != nil {
367
+ if err := constraint .check ( expected , actual ); err != nil {
368
368
violations = append (violations , err .Error ())
369
369
result = false
370
370
}
0 commit comments