Skip to content

Commit ea012da

Browse files
authored
Merge pull request #397 from graphql-java/revert-393-382-type-reference-in-union-type
Revert "#383 added extra readme documentation for specific references"
2 parents 718da24 + e2f56ea commit ea012da

2 files changed

Lines changed: 2 additions & 62 deletions

File tree

README.md

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -295,43 +295,7 @@ GraphQLObjectType person = newObject()
295295
.build();
296296

297297
```
298-
299-
##### Specific Recursive Types
300-
301-
Certain situations require specific type classes as input. For example the possible union types inside a `GraphQLUnionType` are required
302-
to be `GraphQLObjectType` objects. You can't use a `GraphQLTypeReference` in this case as it is not specifically that type.
303-
304-
You can use a `reference` method on each specific type to create a reference to that type.
305-
306-
```java
307-
GraphQLObjectType objectReference = GraphQLObjectType.reference("ObjectReference");
308-
GraphQLInterfaceType interfaceReference = GraphQLInterfaceType.reference("InterfaceReference");
309-
GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType.reference("InputObjectReference");
310-
311-
```
312-
313-
you would use this say like this :
314-
315-
```java
316-
GraphQLUnionType PetType = newUnionType()
317-
.name("Pet")
318-
.possibleType(GraphQLObjectType.reference("Cat"))
319-
.possibleType(DogType)
320-
.typeResolver(new TypeResolver() {
321-
@Override
322-
public GraphQLObjectType getType(Object object) {
323-
if (object instanceof GarfieldSchema.Cat) {
324-
return CatType;
325-
}
326-
if (object instanceof GarfieldSchema.Dog) {
327-
return DogType;
328-
}
329-
return null;
330-
}
331-
})
332-
.build();
333-
334-
```
298+
335299

336300
#### Data fetching
337301

src/test/groovy/readme/ReadmeExamples.java

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public GraphQLObjectType getType(Object object) {
131131
.build();
132132
}
133133

134+
134135
void recursiveTypes() {
135136

136137
GraphQLObjectType person = newObject()
@@ -141,31 +142,6 @@ void recursiveTypes() {
141142
.build();
142143
}
143144

144-
void recursiveTypesSpecifically() {
145-
146-
GraphQLObjectType objectReference = GraphQLObjectType.reference("ObjectReference");
147-
GraphQLInterfaceType interfaceReference = GraphQLInterfaceType.reference("InterfaceReference");
148-
GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType.reference("InputObjectReference");
149-
150-
GraphQLUnionType PetType = newUnionType()
151-
.name("Pet")
152-
.possibleType(GraphQLObjectType.reference("Cat"))
153-
.possibleType(DogType)
154-
.typeResolver(new TypeResolver() {
155-
@Override
156-
public GraphQLObjectType getType(Object object) {
157-
if (object instanceof GarfieldSchema.Cat) {
158-
return CatType;
159-
}
160-
if (object instanceof GarfieldSchema.Dog) {
161-
return DogType;
162-
}
163-
return null;
164-
}
165-
})
166-
.build();
167-
}
168-
169145
void executionStrategies() {
170146

171147
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(

0 commit comments

Comments
 (0)