Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typescript interface to disallow incompatible consumerVersionSelector options #961

Open
devhid opened this issue Oct 14, 2022 — with Slack · 2 comments
Open
Labels
enhancement Indicates new feature requests

Comments

Copy link

devhid commented Oct 14, 2022

For the consumerVersionSelectors field, it is possible to specify an object with the following:

{
    branch: 'master',
    latest: true
}

However, the latest field only applies to tag(s) not branch(es). However, there was no complaints from TypeScript, so I was able to compile and run my provider test where it gave me a 400 error for having an improper client request.

Even though it was an oversight on my part, I think it would help future devs not make mistakes like this by updating the interfaces to disallow incompatible options from existing within the same context.

See slack thread for additional context: https://pact-foundation.slack.com/archives/C9VBGLUM9/p1665548462892049

@mefellows
Copy link
Member

Thanks @devhid. I think it's possible to update the types to match up with https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors.

I think we could also do a better job of surfacing the errors in these cases. e.g. if I added the latest attribute to the deployed selector, it results in this error:

{
  "errors": {
    "consumerVersionSelectors": [
      "cannot specify the field latest with the fields deployed/environment (at index 0)"
    ]
  }
}

@devhid
Copy link
Author

devhid commented Oct 18, 2022

@mefellows Yup, that would definitely be helpful!

@mefellows mefellows added the enhancement Indicates new feature requests label Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
Status: New Issue
Development

No branches or pull requests

2 participants