diff --git a/README.md b/README.md index e6c15b92ab..de080458dd 100644 --- a/README.md +++ b/README.md @@ -295,43 +295,7 @@ GraphQLObjectType person = newObject() .build(); ``` - -##### Specific Recursive Types - -Certain situations require specific type classes as input. For example the possible union types inside a `GraphQLUnionType` are required - to be `GraphQLObjectType` objects. You can't use a `GraphQLTypeReference` in this case as it is not specifically that type. - -You can use a `reference` method on each specific type to create a reference to that type. - -```java -GraphQLObjectType objectReference = GraphQLObjectType.reference("ObjectReference"); -GraphQLInterfaceType interfaceReference = GraphQLInterfaceType.reference("InterfaceReference"); -GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType.reference("InputObjectReference"); - -``` - -you would use this say like this : - -```java -GraphQLUnionType PetType = newUnionType() - .name("Pet") - .possibleType(GraphQLObjectType.reference("Cat")) - .possibleType(DogType) - .typeResolver(new TypeResolver() { - @Override - public GraphQLObjectType getType(Object object) { - if (object instanceof GarfieldSchema.Cat) { - return CatType; - } - if (object instanceof GarfieldSchema.Dog) { - return DogType; - } - return null; - } - }) - .build(); - -``` + #### Data fetching diff --git a/src/test/groovy/readme/ReadmeExamples.java b/src/test/groovy/readme/ReadmeExamples.java index fc88c76715..8d861ea760 100644 --- a/src/test/groovy/readme/ReadmeExamples.java +++ b/src/test/groovy/readme/ReadmeExamples.java @@ -131,6 +131,7 @@ public GraphQLObjectType getType(Object object) { .build(); } + void recursiveTypes() { GraphQLObjectType person = newObject() @@ -141,31 +142,6 @@ void recursiveTypes() { .build(); } - void recursiveTypesSpecifically() { - - GraphQLObjectType objectReference = GraphQLObjectType.reference("ObjectReference"); - GraphQLInterfaceType interfaceReference = GraphQLInterfaceType.reference("InterfaceReference"); - GraphQLInputObjectType inputObjectReference = GraphQLInputObjectType.reference("InputObjectReference"); - - GraphQLUnionType PetType = newUnionType() - .name("Pet") - .possibleType(GraphQLObjectType.reference("Cat")) - .possibleType(DogType) - .typeResolver(new TypeResolver() { - @Override - public GraphQLObjectType getType(Object object) { - if (object instanceof GarfieldSchema.Cat) { - return CatType; - } - if (object instanceof GarfieldSchema.Dog) { - return DogType; - } - return null; - } - }) - .build(); - } - void executionStrategies() { ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(