-
Notifications
You must be signed in to change notification settings - Fork 86
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
Support mutations #16
Comments
Thanks for the issue! Mutations are definitely in the plans, though I've been thinking about the best way to represent them in the API. There are a few changes to the current API that we've also been planning since all the additional features we want to add won't fit easily into the current Fluent interface. However, if you're eager to try the library I can probably get rudimentary mutation support working before the end of the week. I should note that this is definitely still an alpha version so the API may change significantly between releases. |
There's no rush for mutations. I'm starting with querying first and will end up with mutations in two or three weeks. I already assumed this was alpha with the quantity of commits coming in! |
Hi, I've just been playing with this project - any news on mutations support, It would be awesome! |
Hey Andy, I apologize that development of this project has slowed recently as I've I'll work on getting mutations implemented within the next few days and -Chad On Wed, Jun 29, 2016, 11:30 AM andyroper notifications@github.com wrote:
|
Mutations have landed (in dev)! The API is similar to the explicit query API. This is pretty much a requirement since we have to specify both a name and an explicit argument shape. I'll copy an example from the tests for this feature: schema.AddMutation("mutate",
new {id = 0, newVal = 0},
(db, args) => db.MutateMes.AsQueryable().FirstOrDefault(a => a.Id == args.id),
(db, args) =>
{
var mutateMe = db.MutateMes.First(m => m.Id == args.id);
mutateMe.Value = args.newVal;
db.SaveChanges();
}); Going through it one by one, the first line specifies the name. The second specifies the shape of the arguments (used in the It's unfortunate that in this case (and I think probably in many others) that the query to be executed is an exact duplicate of an already defined query. I'm considering ways to improve that, but it's a bit difficult given that the arguments shape for a mutation is unlikely to be reused. Again copying from the tests, the results of executing this look like: var results = gql.ExecuteQuery("mutation { mutate(id:1,newVal:5) { id, value } }");
Test.DeepEquals(results, "{ mutate: { id: 1, value: 5 } }");
var results2 = gql.ExecuteQuery("mutation { mutate(id:1,newVal:123) { id, value } }");
Test.DeepEquals(results2, "{ mutate: { id: 1, value: 123 } }"); |
Excellent - Thanks! |
Hey guys!
Just started looking into GraphQL and your project looks great! I was wondering if there were short term plans for mutation support. I'm looking into creating a project that would do CQRS via GraphQL and this framework looks good but lacks mutation for now!
The text was updated successfully, but these errors were encountered: