title: Pacts: Matching rule for non-empty map (or a field which is not null) needed
body: <p>I need help with writing my consumer Pacts using pact-jvm (<a href="https://github.com/DiUS/pact-jvm" rel="nofollow noreferrer">https://github.com/DiUS/pact-jvm</a>).</p>
  
  <p>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.</p>
  
  <pre><code>"validatedAnswers": [
      {
        "type": "typeA",
        "answers": {
          "favourite_colour": "Blue",
          "correspondence_address": {
              "line_1": "Main St",
              "postcode": "1A 2BC",
              "town": "London"
          }
        }
      },
      {
        "type": "typeB",
        "answers": {
          "first_name": "Firstname",
          "last_name": "Lastname",
        }
      }
    ]
  </code></pre>
  
  <p>but we're only interested in some of those answers.</p>
  
  <p>NOTE: The above is only an example showing the structure of <code>validatedAnswers</code>. Each <code>answers</code> map has dozens of elements. </p>
  
  <p>What we really need is this: <a href="https://github.com/pact-foundation/pact-specification/issues/38" rel="nofollow noreferrer">https://github.com/pact-foundation/pact-specification/issues/38</a>, 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?</p>
  
  <p>This: </p>
  
  <pre><code>new PactBuilder().serviceConsumer('A').hasPactWith('B')
  .port(findAvailablePort()).uponReceiving(...)
  .willRespondWith(status: 200, headers: ['Content-Type': 'application/json'])
  .withBody {
    validatedAnswers minLike(1) {
       type string()
       answers {
       }
    }
  }
  </code></pre>
  
  <p>doesn't work because it mean <code>answers</code> is expected to be empty ("Expected an empty Map but received Map( [...] )", see also <a href="https://github.com/DiUS/pact-jvm/issues/298" rel="nofollow noreferrer">https://github.com/DiUS/pact-jvm/issues/298</a>).</p>
  
  <p>So what I would like to do is something like this:</p>
  
  <pre><code>.withBody {
      validatedAnswers minLike(1) {
           type string()
           answers Matchers.map()
      }
  }
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>validatedAnswers minLike(1) {
       type string()
       answers {
               keyLike 'title', notNull()
       }
  }
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>validatedAnswers minLike(1) {
       type string()
       answers notNull()
  }
  </code></pre>
  
  <p>Can it be done?</p>