Skip to content

Commit 8064a84

Browse files
committed
Update example and readme.
1 parent 2a6a83a commit 8064a84

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Since your GraphQL schema is independent of your data model, this makes your cla
2828
<dependency>
2929
<groupId>com.coxautodev</groupId>
3030
<artifactId>graphql-java-tools</artifactId>
31-
<version>2.0.1</version>
31+
<version>2.1.2</version>
3232
</dependency>
3333
```
3434

@@ -157,7 +157,7 @@ Resolvers and data classes must be provided to the schema parser:
157157
SchemaParser.newParser()
158158
// ...
159159
.resolvers(new Query(bookRepository), new BookResolver(authorRepository))
160-
.dataClasses(Author.class)
160+
.dictionary(Author.class)
161161
```
162162

163163
*Note:* Data classes that have resolvers don't also need to be passed to `dataClasses`, such as `BookResolver` above.
@@ -172,7 +172,7 @@ Any enums in your java classes that map to GraphQL enums must be provided to the
172172
```java
173173
SchemaParser.newParser()
174174
// ...
175-
.enums(Type.class, MyOtherEnum.class)
175+
.dictionary(Type.class, MyOtherEnum.class)
176176
```
177177

178178
Enum values are automatically mapped by class name and `toString()`.
@@ -218,6 +218,16 @@ SchemaParser.newParser()
218218
.scalars(myUuidScalar)
219219
```
220220

221+
### Renaming Types
222+
223+
Sometimes your Java classes don't line up perfectly with your GraphQL schema, so GraphQL Java Tools allows you to "rename" your classes:
224+
```java
225+
SchemaParser.newParser()
226+
// ...
227+
.dictionary(Author.class)
228+
.dictionary("Book", BookClassWithIncorrectName.class)
229+
```
230+
221231
### Making the graphql-java Schema Instance
222232

223233
After you've passed all relavant schema files/class to the parser, call `.build()` and `.makeExecutableSchema()` to get a graphql-java `GraphQLSchema`:

‎example/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<dependency>
4848
<groupId>com.coxautodev</groupId>
4949
<artifactId>graphql-java-tools</artifactId>
50-
<version>2.0.1</version>
50+
<version>2.1.2</version>
5151
</dependency>
5252
<dependency>
5353
<groupId>com.graphql-java</groupId>

0 commit comments

Comments
 (0)