Question: arrayContaining Matcher and the dynamic JSON keys.
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 56
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
❔ 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.
- Other Related Issues: #107
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository files or tests are named. Start with the linked pact-js arrayContaining matcher documentation, then read issue #107 and the Pact v4 specification's combine operators to compare the proposed approaches. Done means defining how arrays containing multiple dynamic JSON objects are matched and documenting or testing the supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100