Stanislav Vodetskyi
12/06/2023, 12:00 AMBoris
12/06/2023, 12:13 AMBoris
12/06/2023, 12:19 AMlike
matchers (atLeastOneLike
and others in JS, idk what language your consumer is in) to try to constrain the logic, but it's a bit hard to put strong reasoning around that kind of interaction.Boris
12/06/2023, 12:20 AMBoris
12/06/2023, 12:20 AMStanislav Vodetskyi
12/06/2023, 12:46 AMlike
matchers (atLeastOneLike
and others in JS, idk what language your consumer is in) to try to constrain the logic, but it's a bit hard to put strong reasoning around that kind of interaction.
so how would I express something like a list of items, each has a name field, and for one of them the name equals X, and that item matches the template, don't care about the others
?
If I do something like:
EachLike(Map{"name": Equality("x")})
this means the provider can respond with a list that contains multiple items with the same name? Or should my consumer not care?
> Ideally, fix the API up in future, so the client doesn't have to do the work itself (e.g. an endpoint that passes the name as a param, and gets back the expected entity, or a list if that makes more sense)
agreed, this would be ideal, but idk if/when the api team can get to thisBoris
12/06/2023, 2:38 AMStanislav Vodetskyi
12/06/2023, 2:39 AMBoris
12/06/2023, 2:40 AMHow would my pact be different if it was explicit in the request?If an expected value in the response is supplied in the request, it's easier to demonstrate the coupling. Worst case, though, it can be coupled in the state description.
Stanislav Vodetskyi
12/06/2023, 2:41 AMBoris
12/06/2023, 2:43 AMGET /lol/face?name=very-important-value
expects a response like
{
"faces": [
{
"id": int(example: 3),
"name": "very-important-value"
}
]
}
Stanislav Vodetskyi
12/06/2023, 2:44 AMGiven("very-important-value exists")
and expect the same response as above, isn't it the same?Boris
12/06/2023, 2:45 AMBoris
12/06/2023, 2:45 AMStanislav Vodetskyi
12/06/2023, 2:47 AM{
"faces": [
{
"id": int(example: 3),
"name": "very-important-value"
},
{
"id": int(example: 5),
"name": string(example: 'whatever')
}
]
}
with state like given(very-important-value exists, among others)
(but structured)Boris
12/06/2023, 2:48 AMStanislav Vodetskyi
12/06/2023, 2:48 AMBoris
12/06/2023, 2:58 AMStanislav Vodetskyi
12/06/2023, 2:59 AMStanislav Vodetskyi
12/06/2023, 2:59 AMBoris
12/06/2023, 3:00 AM