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

How to generate contract with matchers by type only? #11

Open
Maxim-Filimonov opened this issue Jul 10, 2022 · 3 comments
Open

How to generate contract with matchers by type only? #11

Maxim-Filimonov opened this issue Jul 10, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Maxim-Filimonov
Copy link

Hi,
I noticed that all contracts generated by the adapter seem to presume that we need an exact match only. I guess for bi-directional contracts it doesn't really matter as provider never executes consumer contact.
However, I'm trying to use this plugin for consumer contracts due to lack of the Graphql support with bi-directional contracts. In that case it would be great to be able to use like matchers especially for response.
Is it possible?

@YOU54F
Copy link
Member

YOU54F commented Jul 19, 2022

Hey,

Not currently possibly to use this tool with matchers, in regular CDCT verification

Yes the adapter was built with the BDCT use case in mind, and doesn't supporting generating of matchers in the consumer contract.

Happy for you to suggest an API design for generating matchers or a PR

Would you expect this on headers, specific ones or otherwise

The request/response body?

so a body with {"foo":"bar"} would generate a matcher with foo: string?

@Maxim-Filimonov
Copy link
Author

My plan was to use it for req/res body.
I'm wondering would it be even possible with current code? As far as I understand code it uses cypress.intercept function and injects AFTER while cypress_adapter did the reverse. Which gave it opportunity to inject extractPayload call into the flow before passing it to cypress.

@YOU54F
Copy link
Member

YOU54F commented Dec 9, 2022

#19 👈🏾 Check out this PR for anyone interested in matchers as part of pact-cypress-adapter

@YOU54F YOU54F added enhancement New feature or request help wanted Extra attention is needed labels Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants