-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
graphql queries verification broken with graphql-tag
#254
Comments
Oh my, I'm sorry! I think we might need to take a step back here and think a bit more carefully. If I understand correctly, I think this is the specific requirement needed:
Would this satisfy your requirement? @ngbrown would this work for you also? |
Hi @mefellows, thanks for answering. Absolutely no problem, thank you for putting in time on this! I think it would work. Tests using Also, I noticed that the queries done with Like: person {
name
__typename
} And the verification is against Thank you! |
No worries. Can you please put together a small gist/PR to demonstrate what you mean by the following:
Using the example in the repository, it doesn't seem to pass that extra field through. The test is using the actual client code, which constructs the query using I'm actually surprised at how many people seem to be using Pact with GraphQL - this gives some indication that it's worthwhile adding to the other libraries also (once we iron out these wrinkles!). FWIW setting those fields to |
I'll try to create something reproducing the
Totally agree. When I'm finished creating the pact with pact-js, my idea is to consume it with pact-jvm. The
It seems that way. But maybe a |
No worries at all. It'll just help us think through how we might be able to deliver this. This being said, if your actual client query is sending through extra fields but is failing the pact test, then it really belongs in the expectation in the first place - the point of the test is to confirm what your code is doing is as expected. I'll share this with other maintainers and get their thoughts. Any feedback on your use with Pact vs potential other alternatives would be great (I believe Apollo has a way of locking schemas on both client/server?). In the meanwhile, I'll explore API options to support both |
I'm not clear on why Pact need modes around the GraphQL DSL. I was using Pact with GraphQL queries before the DSL helper was added. It was working fine then, but I had to be careful to get the spaces exactly the same as what the request actually was. Now with the DSL helper, the spacing differences are ignored. If the only change is to handle not having If it's to change the |
Hi @ngbrown, I'm using Apollo's As the example in this repo uses Thanks |
I think I'm going to leave the extra option out for now to reduce confusion / noise in the API itself, and ensure that only |
@tomasAlabes I'm facing same issue and I disabled __typename in the consumer tests when mocking mutation but now fails provider tests. Did you find a workaround for this? ● Verify graphql endpoint with pact testing › should adhere to pact contract
|
I solved it with the new |
Software versions
10.13.0
Expected behaviour
Related to #243
When using the
graphql-tag
package like in the graphql example:Actual behaviour
With
graphql-tag
, when the query doesn't have variables, the post is done withand without operation:
With the latest commit, now those attributes are not part of the body, hence the verification fails. As the tests are written with manual queries and not with the
graphql-tag
package, tests are sucessfull.Steps to reproduce
Just remove the variables of the example in this repo and the example fails to verify.
Relevant log files
The text was updated successfully, but these errors were encountered: