pact-foundation / pact-specification

Describes the pact format and verification specifications
MIT License
295 stars 28 forks source link

Either matcher in Pact #97

Closed davetc4k closed 2 years ago

davetc4k commented 2 years ago

This seems to be a common issue where a response contains a list of objects and each object can have an attribute of either an empty list or one populated with items.

Currently EachLike has a min of 1, meaning, (as I understand it), the list of objects must all have either an attribute for a empty list or list of length > 0.

Propsal: Either matcher which allows the objects in the list to have a list , (or map or whatever) in one of two states , empty or popluated (with ints , strings , maps or whatever the developer defines)

mefellows commented 2 years ago

See https://docs.pact.io/faq#why-is-there-no-support-for-specifying-optional-attributes for why we don't support this.

See also https://github.com/pact-foundation/pact-support/pull/11 if it makes you feel better 😆

davetc4k commented 2 years ago

OK I see you have this approach but its a total deal breaker for us , so we probably won't use your product. I do not understand why either this or that is against your 'rules' .