-
Notifications
You must be signed in to change notification settings - Fork 0
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
Official Extension: GraphQL API Mocking #13
Comments
@oleg-nenashev you can assign this issue to me. I will be working on the same. |
Done! |
I went through this and figured out one of the approaches and discussed it with Tom. We will be parsing GraphQL queries and converting them to Document objects(https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/language/Document.java). There is already a pre-written equality library for comparing these Document objects https://github.com/com2ghz/graphql-query-compare. I will be using the same and comparing GraphQL queries/objects. We can also write our comparator if required instead of using this. We can also convert this Document Object to JSON and can use a JSON comparator if required. Since this approach requires graphql-java to be part of JAR, we'll be implementing this as a core extension. |
I am not sure this is what the equality matcher is what user would expect. GraphQL is basically a query with filters... a lot of them. So I do not see much value in comparing the requests with the reference, and I would rather expect processing on the handler level similar to a real GraphQL service. One could also expect filtering by operation name (similar to HTTP request type), and maybe by arguments or some combinations. |
@oleg-nenashev I won't do any sort of exact match. I will be converting it to Document object which describes GraphQL query with all sort of filters. I would only be making necessary validations for equality to make sure that it corresponds to same query. |
Ack! Ok, then no objections |
As discussed with @kapishmalik and @tomakehurst , it should be rather implemented as an extension. I will move it to the Ecosystem repo until we have a better location @kapishmalik could you please add the current design to the issues |
https://github.com/wiremock/wiremock-graphql-extension is now available for preview. Updated the state and assigned to @nilwurtz so that the roadmap entry is correct |
Proposal
GraphQL becomes more and more popular, and services provide it along with classic REST APIs. It would be nice to support mocking of GraphQL requests with feature-rich request matching and response logic, including special extensions support
Implementation
References
The text was updated successfully, but these errors were encountered: