Open bethesque opened 3 years ago
Awesome! Thanks for this. Does the ruby core just print errors in text on stderr?
Yes. I've actually already used these selectors in the CI/CD JS workshop, so I know they work. But Typescript blah blah.
I've just released pact-node 10.13.5 and pact-core 13.1.3 - both with the new types.
it's my preference that the consumer version selectors are not strongly typed,
I'm thinking about this a bit - I reckon we could actually do both. I think with typescript we can say "this is either an object shaped like so, or one with arbitrary keys" - this would mean that typescript users will get intellisense in their editors, but also it would be valid to put unknown keys in too.
Is the value always a string
or boolean
, or should we allow arbitrary objects as values?
That sounds ideal Tim.
So far, only strings and booleans for values. I wouldn't rule out having arrays in the future, but I have no plans for it currently.
While you're in there, we now have { branch: "<name>" }
and { mainBranch: true }
. Could you add those please.
What's the status on this @TimothyJones? I'm adding a section in the docs to indicate which languages/versions support this selector.
Just noting that this is available in both the mainline and beta versions. We haven't made the type adjustment above as Tim suggested, but the type support is there and you can brute force in new options should you want. I'll leave this open to track the suggested improvement above.
I've updated the title to (I hope) reflect the new intent of this story.
Please add support for the following keys to be used in the consumer version selectors when fetching pacts for verification:
These keys can be used in various combinations ( eg.
{ "environment": "prod", released: true, consumer: "Foo" }
). Please allow any combination of keys, and do not validate them locally, as the validation rules can change over time as support is added for new selectors - just ensure that any errors returned from the API are displayed clearly to the user.See https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown for the usage docs of each selector.
As more selectors will be added over time, it's my preference that the consumer version selectors are not strongly typed, and are just passed through straight from the configuration object to the API, so that we don't have to make code changes to the Pact clients each time we add new selectors. (eg. there will be new selectors coming for branch support very soon). I understand that this is not compatible with the idioms of every Pact client language however, so do whatever you need to do to make the new selectors work elegantly within your language.
Please update https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors/ for your language once the selectors have been released.