Hi. I have a json structure like this: ```{ "data"...
# general
a
Hi. I have a json structure like this:
Copy code
{
  "data": [
    {
      "id": "123456789"
    },
    {
      "id": "111111111",
      "optional_stuff": {
        "data_map": {
          "blah_1": true,
          "blah_2": 123456
        }
      }
    }
  ]
}
So my question is how to write the pact contract such that
"id"
is mandatory but
"optional_stuff"
is optional? At the moment I have to only specify the
"id"
part as it's unclear if pact supports optional data.
y
you would create two contract tests, one which requires the optional stuff, one which doesn’t. You can use provider states to ensure that the optional stuff you require, is able to be setup by the provider during their verification
a
OK. I'll look into this, thanks for the speedy response
y
No problem Alan 🙂