Skip to content

Commit 836a558

Browse files
tklovettyrashk
authored andcommitted
Update Type Inference docs (Issue #34) (#53)
The mechanism for registering custom type functions changed a long time ago, this brings the documentation up to date with those changes.
1 parent 3f551c7 commit 836a558

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,21 @@ By default, standard GraphQL types (String, Integer, Long, Float, Boolean, Enum,
119119

120120
Stream type is also supported and treated as a list.
121121

122-
If you want to register an additional type (for example, UUID), you have to implement `TypeFunction` for it and register it with `DefaultTypeFunction`:
122+
If you want to register an additional type (for example, UUID), you have to create a new class implementing `TypeFunction` for it:
123123

124124
```java
125-
DefaultTypeFunction.register(UUID.class, new UUIDTypeFunction());
125+
public class UUIDTypeFunction implements TypeFunction {
126+
...
127+
}
128+
```
129+
130+
And register it with `GraphQLAnnotations`:
131+
132+
```java
133+
GraphQLAnnotations.register(new UUIDTypeFunction())
134+
135+
// or if not using a static version of GraphQLAnnotations:
136+
// new GraphQLAnnotations().registerType(new UUIDTypeFunction())
126137
```
127138

128139
You can also specify custom type function for any field with `@GraphQLType` annotation.

0 commit comments

Comments
 (0)