Skip to content

Question: arrayContaining Matcher and the dynamic JSON keys.Β #108

@StasMarynych

Description

@StasMarynych

❔ Question

Are there any possibility to define the expected response in case of dynamic JSON keys (set of the different JSON objects)? For example something like arrayContaining in pact-js.

πŸ’¬ Context

The main problem is that the dynamic JSON objects are located in the array, so there can be more than 1 different object in the array. There is a predefined set of the possible objects, so if there are no any limitations I would consider implementing same matcher as in pact-js version. (I'd love to help with that or v4 specification implementation.)

JSON Sample

{
  "items": [
    {
      "id": "some-id1",
      "config": { 
        "foo": "true"
      }
    },
    {
      "id": "some-id2",
      "config": {
        "bar": { ... }
      }
    },
    {
      "id": "some-id3",
      "config": { 
        "baz": 100 
       }
    }
  ]
}

Notes:
By the way, there is an option to test such objects one by one (1 object in the array per test) using the provider state, but the main idea is to test the composition of such objects.

🀝 Relationships

Looks like in v4 specification combine operators could be used, so that will solve the issue as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions