Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
macluck committed Oct 25, 2017
1 parent 8f141d9 commit 4b637c0
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fragment comparisonFields on Worker {
### Query with variables

Now you can generate really complex queries with variables as well. In order to define variables, we need to define
an operation type and name. Notice, currently on `:query` operations are supported.
an operation type and name.


```clj
Expand Down Expand Up @@ -154,6 +154,30 @@ fragment comparisonFields on Worker {

```

### Mutation

Mutations are also supported, just use `:mutation` operation type:

```clj

(v/graphql-query {:venia/operation {:operation/type :mutation
:operation/name "AddProjectToEmployee"}
:venia/variables [{:variable/name "id"
:variable/type :Int!}
{:variable/name "project"
:variable/type :ProjectNameInput!}]
:venia/queries [[:addProject {:employeeId :$id
:project :$project}
[:allocation :name]]]})

=> prettified:
mutation AddProjectToEmployee($id:Int!,$project:ProjectNameInput!) {
addProject(employeeId:$id, project:$project) {
allocation,
name
}
}
```

### Validation

Expand Down

0 comments on commit 4b637c0

Please sign in to comment.