You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thisbehaviorcanbeadjustedusingthe `generateAll` option (See [usage](#usage)). When setting it to `false` the code generator will only generate code if the `@kResolver` directive has been added in the schema.
36
42
This is also useful as the `graphql-java` library provides a property resolver, which mostly takes most of the work.
@@ -55,7 +61,7 @@ type User {
55
61
}
56
62
```
57
63
58
-
#### Avoid generating all object types (`@kGenerate`)
64
+
### Avoid generating all object types (`@kGenerate`)
Sometimes there are cases where you want to update certain data, but the attribute you want to update is nullable.
87
+
88
+
Given the following mutation `updateUser(name: String, surname: String)` which allows you to partially update your User.
89
+
The attribute `surname` can be null within your database, which means the mutation can be called with following data:
90
+
`{"name": "test", "surname": null}`.
91
+
When explicitly setting the `surname` to `null` you simply tell your resolver, that you want to set the `surname` to `null`.
92
+
93
+
Now to the case where `@kDoubleNull` comes into play: You may never want to update the `surname` attribute, therefore you may
94
+
call the mutation with the following data: `{"name": "test"}`. When not using the `@kDoubleNull` directive you get `String?`
95
+
as type for the `surname` attribute, which makes it unable to differ if the user want's to explicitly set the value to `null` or simply not update it.
96
+
97
+
When using `@kDoubleNull` on your mutation parameter (`updateUser(name: String, surname: String @kDoubleNull)`) you get `V<String?>?` as type for the `surname` attribute.
98
+
As the type is now double nullable you can differ if the value shall be set to null, or the value should not be updated at all.
99
+
100
+
101
+
### Pagination (`@kPagination`)
102
+
This code generator also supports the [GraphQL Cursor Connections Specification](https://facebook.github.io/relay/graphql/connections.htm) which allows you to easily implement pagination on your queries.
103
+
104
+
#### With [Spring Boot Integration](/docs/spring-boot-integration/getting-started.md)
105
+
Simply add the `@kPagination` directive to your field definition, and the code generator and the Spring Boot Integration will do the rest for you:
106
+
```graphql
107
+
typeQuery {
108
+
# ...
109
+
getUsers: [User] @kPagination
110
+
# ...
111
+
}
112
+
```
113
+
114
+
#### Standalone
115
+
WhenusingthecodegeneratorwithouttheSpringBootIntegrationyouhavetodefinethe `*Connection`, `*Edge` and `PageInfo` typesbyyourself.
0 commit comments