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

Add mutation examples #9

Open
ivan-kolmychek opened this issue Feb 4, 2016 · 10 comments
Open

Add mutation examples #9

ivan-kolmychek opened this issue Feb 4, 2016 · 10 comments

Comments

@ivan-kolmychek
Copy link

It would be nice to have some examples of changing data through graphql mutations.

@joshprice
Copy link
Member

Yes absolutely. This is definitely missing and we'll add these in this week.

@ivan-kolmychek
Copy link
Author

@joshprice thank you. While I got the general idea from looking at the code itself and examples for other languages, I think it would benefit anyone who explores the GraphQL through this example repo to be able to see the examples for mutations, clone them to their machine and play around to see how do they work.

@joshprice
Copy link
Member

It's definitely our top priority, thanks for the bug report. 🙏

@mechabyte
Copy link

Is there an update on the progress of these code examples?

@0x6e6562
Copy link

Has anybody come across any mutation examples in external repos?

@ivan-kolmychek
Copy link
Author

@0x6e6562 there are some examples in repos from official GraphQL Github organization.

@ivan-kolmychek
Copy link
Author

The graphql-relay-js repo has multiple mentions too.

@ivan-kolmychek
Copy link
Author

Also, here is the post on Medium about mutations: https://medium.com/@tarkus/validation-and-user-errors-in-graphql-mutations-39ca79cd00bf

@ivan-kolmychek
Copy link
Author

ivan-kolmychek commented Jul 20, 2016

The docs from graphql-relay-ruby also mention mutations

Quote (empathis mine):

Mutations allow Relay to mutate your system. They conform to a strict API which makes them predictable to the client.
...
Members of MutationType are mutation fields. For GraphQL in general, mutation fields are identical to query fields except that they have side-effects (which mutate application state, eg, update the database).
For Relay-compliant GraphQL, a mutation field must comply to a strict API. GraphQL::Relay includes a mutation definition helper (see below) to make it simple.

So, there are 1) regular GraphQL mutations, which are queries that have side-effects like modifying the database and 2) Relay mutations that are somehow stricter in terms of API.

@kespinola
Copy link

I'm also wondering how to handle file uploads. Sending file using relay getFiles(), but I don't have access to the param holding the file upload.

Seeing no info here in regards to %Plug.Upload https://github.com/graphql-elixir/graphql/blob/master/lib/graphql/execution/executor.ex#L141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants