-
-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matching rule for non-empty map or a field which is not null #727
Comments
Anyone? Anything? |
This is impossible to support with the current implementation. The behaviour is to apply the matchers at the attribute level, and you can't apply them conditionally based on a predicate. What we need to be able to apply a set of matchers based on a predicate: validatedAnswers minLike(1) {
when(type == "typeA") {
favourite_colour string()
...
}
} But this will not be possible to implement without a change to the specification. |
Oh yes!!!! Having predicate-based matchers would solve so many problems! It would be great :D |
Yes it will have to be a V4 change because it will require a change to the pact file format as well as how the matchers are applied. |
@uglyog will this be included in V4? |
@alexfdz we are going to look at having sets of matching rules applied to different objects in lists. pact-foundation/pact-specification#38 will track this. |
My problem is I have a field which is a list (an array) of maps. Each map can have elements of different types (strings or sub-maps), eg.
and we're only interested in some of those answers.
What we really need is this: pact-foundation/pact-specification#38, but it's planned for v.4. In the meantime we're trying a different approach. What I'm attempting to do now is to specify that each element of the list is a non-empty map. Another approach is to specify that each element of the list is not null. Can any of this be done using Groovy DSL?
This:
doesn't work because it mean
answers
is expected to be empty ("Expected an empty Map but received Map( [...] )", see also #298).So what I would like to do is something like this:
or:
or:
Can it be done?
The text was updated successfully, but these errors were encountered: