Skip to content

Commit d771570

Browse files
author
Thomas Draier
committed
Removed wrapper to fix usage of SchemaPrinter
1 parent e1ceb93 commit d771570

File tree

3 files changed

+15
-43
lines changed

3 files changed

+15
-43
lines changed

src/main/java/graphql/annotations/GraphQLAnnotations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public GraphQLOutputType getOutputType(Class<?> object) throws GraphQLAnnotation
270270
} else if (Enum.class.isAssignableFrom(object)) {
271271
type = getEnumBuilder(object).build();
272272
} else {
273-
type = new GraphQLObjectTypeWrapper(object, getObjectBuilder(object).build());
273+
type = getObjectBuilder(object).build();
274274
}
275275

276276
typeRegistry.put(typeName, type);

src/main/java/graphql/annotations/GraphQLObjectTypeWrapper.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/test/java/graphql/annotations/GraphQLObjectTest.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import graphql.schema.GraphQLObjectType;
2929
import graphql.schema.GraphQLSchema;
3030
import graphql.schema.GraphQLType;
31+
import graphql.schema.idl.SchemaParser;
32+
import graphql.schema.idl.SchemaPrinter;
33+
import graphql.schema.idl.TypeDefinitionRegistry;
3134
import org.testng.annotations.BeforeMethod;
3235
import org.testng.annotations.Test;
3336

@@ -154,8 +157,17 @@ public void metainformation() {
154157
@Test
155158
public void objectClass() {
156159
GraphQLObjectType object = GraphQLAnnotations.object(TestObject.class);
157-
assertTrue(object instanceof GraphQLObjectTypeWrapper);
158-
assertEquals(((GraphQLObjectTypeWrapper) object).getObjectClass(), TestObject.class);
160+
assertTrue(object instanceof GraphQLObjectType);
161+
}
162+
163+
@Test
164+
public void testSchema() {
165+
GraphQLObjectType object = GraphQLAnnotations.object(TestObject.class);
166+
String schema = new SchemaPrinter().print(object);
167+
assertTrue(schema.contains("type TestObject {"));
168+
TypeDefinitionRegistry reg = new SchemaParser().parse(schema);
169+
assertTrue(reg.getType("TestObject").isPresent());
170+
assertEquals(new SchemaParser().parse(schema).getType("TestObject").get().getChildren().size(), 8);
159171
}
160172

161173
@Test

0 commit comments

Comments
 (0)