Skip to content

Commit 83848bf

Browse files
committed
Update README
1 parent b1b24ef commit 83848bf

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

README.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ As you can see, we can achieve our goal with just a few tweaks from the original
3535

3636
### Features
3737
- DSL builder style. Make it easier to read and use.
38-
- Support both Query and Mutation operation.
38+
- Support CursorConnection field and Input object for mutation in Relay.
3939

4040
### Set up
4141
Adding Kraph to `build.gradle`
@@ -49,8 +49,56 @@ Adding Kraph to `build.gradle`
4949
}
5050
```
5151

52-
### Usage
53-
Please see the example from `sample` folder for now. We will update this part ASAP.
52+
### Guide
53+
If you are not familiar with GraphQL syntax, We recommended to read on this [specification](https://facebook.github.io/graphql/) to have an overview of how to write Graphql. Usually, you should be able to use the query from other tools(e.g. [GraphiQL](https://github.com/graphql/graphiql)) with a few tweaks. First, let's see what Kraph provided for you.
5454

55+
- `query` represents QUERY operation in GraphQL. It can be named by passing String as a parameter. The `query` block can only contains `field` or `fieldObject`.
56+
```
57+
/*
58+
* query GetUsers {
59+
* ...
60+
* }
61+
*/
62+
Kraph {
63+
query("GetUsers") {
64+
...
65+
}
66+
}
67+
```
68+
- `field` and `fieldObject` represents FIELD in SELECTION SET. The different is that `fieldObject` allow you to have it owns SELECTION SET, which represent data object in GraphQL. Both of them have a parameter named `args` for arguments in paritcular field.
69+
```
70+
/*
71+
* query {
72+
* users {
73+
* name
74+
* email
75+
* avatarUrl(size: 100)
76+
* }
77+
* }
78+
*/
79+
Kraph {
80+
query {
81+
fieldObject("users") {
82+
field("name")
83+
field("email")
84+
field("avatarUrl", args = mapOf("size" to 100))
85+
}
86+
}
87+
}
88+
```
89+
- `mutation` represents MUTATION operation in GraphQL. The `mutation` block can have only contains `func`.
90+
```
91+
/*
92+
* mutation updateUserProfile {
93+
* ...
94+
* }
95+
*/
96+
Kraph {
97+
mutation("UpdateUserProfile") {
98+
...
99+
}
100+
}
101+
```
102+
- `func` represents as FIELD inside MUTATION block. The reason we did not used `fieldObject`
55103
### Contributing to Kraph
56104
We use Github issues for tracking bugs and requests. Any feedback and/or PRs is welcome.

core/src/main/kotlin/com/taskworld/kraph/lang/relay/Mutation.kt renamed to core/src/main/kotlin/com/taskworld/kraph/lang/relay/RelayMutation.kt

File renamed without changes.

0 commit comments

Comments
 (0)