diff --git a/elide-datastore/elide-datastore-hibernate/src/test/java/com/yahoo/elide/datastores/hibernate/hql/SubCollectionFetchQueryBuilderTest.java b/elide-datastore/elide-datastore-hibernate/src/test/java/com/yahoo/elide/datastores/hibernate/hql/SubCollectionFetchQueryBuilderTest.java index 00f9634954..54c46b1eab 100644 --- a/elide-datastore/elide-datastore-hibernate/src/test/java/com/yahoo/elide/datastores/hibernate/hql/SubCollectionFetchQueryBuilderTest.java +++ b/elide-datastore/elide-datastore-hibernate/src/test/java/com/yahoo/elide/datastores/hibernate/hql/SubCollectionFetchQueryBuilderTest.java @@ -191,8 +191,8 @@ public void testSubCollectionFetchWithSortingAndFilters() { String expected = "SELECT example_Book FROM example.Author example_Author__fetch " + "JOIN example_Author__fetch.books example_Book " - + "LEFT JOIN FETCH example_Book.publisher example_Book_publisher " - + "WHERE example_Book_publisher.name IN (:publisher_name_XXX) AND example_Author__fetch=:example_Author__fetch order by example_Book.title asc"; + + "LEFT JOIN FETCH example_Book.publisher example_Book_publisher " + + "WHERE example_Book_publisher.name IN (:publisher_name_XXX) AND example_Author__fetch=:example_Author__fetch order by example_Book.title asc"; String actual = query.getQueryText(); actual = actual.replaceFirst(":publisher_name_\\w+", ":publisher_name_XXX"); diff --git a/elide-graphql/src/main/java/com/yahoo/elide/graphql/GraphQLConversionUtils.java b/elide-graphql/src/main/java/com/yahoo/elide/graphql/GraphQLConversionUtils.java index 338f6e4abc..23723167ba 100644 --- a/elide-graphql/src/main/java/com/yahoo/elide/graphql/GraphQLConversionUtils.java +++ b/elide-graphql/src/main/java/com/yahoo/elide/graphql/GraphQLConversionUtils.java @@ -63,7 +63,7 @@ public class GraphQLConversionUtils { public GraphQLConversionUtils(EntityDictionary entityDictionary, NonEntityDictionary nonEntityDictionary) { this.entityDictionary = entityDictionary; this.nonEntityDictionary = nonEntityDictionary; - this.nameUtils = new GraphQLNameUtils(dictionary); + this.nameUtils = new GraphQLNameUtils(entityDictionary); registerCustomScalars(); } diff --git a/elide-graphql/src/main/java/com/yahoo/elide/graphql/ModelBuilder.java b/elide-graphql/src/main/java/com/yahoo/elide/graphql/ModelBuilder.java index dfb277b788..29eb8e5907 100644 --- a/elide-graphql/src/main/java/com/yahoo/elide/graphql/ModelBuilder.java +++ b/elide-graphql/src/main/java/com/yahoo/elide/graphql/ModelBuilder.java @@ -19,7 +19,6 @@ import graphql.Scalars; import graphql.schema.DataFetcher; import graphql.schema.GraphQLArgument; -import graphql.schema.GraphQLInputObjectType; import graphql.schema.GraphQLInputType; import graphql.schema.GraphQLList; import graphql.schema.GraphQLObjectType; @@ -69,8 +68,6 @@ public class ModelBuilder { private Map, GraphQLObjectType> connectionObjectRegistry; private Set> excludedEntities; - private HashMap convertedInputs = new HashMap<>(); - /** * Class constructor, constructs the custom arguments to handle mutations * @param entityDictionary elide entity dictionary @@ -82,7 +79,7 @@ public ModelBuilder(EntityDictionary entityDictionary, DataFetcher dataFetcher, String apiVersion) { this.generator = new GraphQLConversionUtils(entityDictionary, nonEntityDictionary); this.entityDictionary = entityDictionary; - this.nameUtils = new GraphQLNameUtils(dictionary); + this.nameUtils = new GraphQLNameUtils(entityDictionary); this.dataFetcher = dataFetcher; this.apiVersion = apiVersion; @@ -152,7 +149,7 @@ public void withExcludedEntities(Set> excludedEntities) { * @return The built schema. */ public GraphQLSchema build() { - Set> allClasses = dictionary.getBoundClassesByVersion(apiVersion); + Set> allClasses = entityDictionary.getBoundClassesByVersion(apiVersion); if (allClasses.isEmpty()) { throw new IllegalArgumentException("None of the provided classes are exported by Elide"); @@ -265,7 +262,7 @@ private GraphQLObjectType buildQueryObject(Class entityClass) { log.debug("Building query attribute {} {} with arguments {} for entity {}", attribute, attributeClass.getName(), - dictionary.getAttributeArguments(attributeClass, attribute).toString(), + entityDictionary.getAttributeArguments(attributeClass, attribute).toString(), entityClass.getName()); GraphQLType attributeType = @@ -384,22 +381,6 @@ private GraphQLInputType buildInputObjectStub(Class clazz) { GraphQLInputType attributeType = generator.attributeToInputObject(clazz, attributeClass, attribute); - if (attributeType instanceof GraphQLInputObjectType) { - String objectName = attributeType.getName(); - if (!convertedInputs.containsKey(objectName)) { - MutableGraphQLInputObjectType wrappedType = - new MutableGraphQLInputObjectType( - objectName, - ((GraphQLInputObjectType) attributeType).getDescription(), - ((GraphQLInputObjectType) attributeType).getFields() - ); - convertedInputs.put(objectName, wrappedType); - attributeType = wrappedType; - } else { - attributeType = convertedInputs.get(objectName); - } - } - builder.field(newInputObjectField() .name(attribute) .type(attributeType) diff --git a/elide-graphql/src/main/java/com/yahoo/elide/graphql/PersistentResourceFetcher.java b/elide-graphql/src/main/java/com/yahoo/elide/graphql/PersistentResourceFetcher.java index 067d3572f0..a35805c491 100644 --- a/elide-graphql/src/main/java/com/yahoo/elide/graphql/PersistentResourceFetcher.java +++ b/elide-graphql/src/main/java/com/yahoo/elide/graphql/PersistentResourceFetcher.java @@ -45,13 +45,10 @@ */ @Slf4j public class PersistentResourceFetcher implements DataFetcher { - private final ElideSettings settings; - @Getter private final NonEntityDictionary nonEntityDictionary; - public PersistentResourceFetcher(ElideSettings settings, NonEntityDictionary nonEntityDictionary) { - this.settings = settings; + public PersistentResourceFetcher(NonEntityDictionary nonEntityDictionary) { this.nonEntityDictionary = nonEntityDictionary; } diff --git a/elide-graphql/src/main/java/com/yahoo/elide/graphql/QueryRunner.java b/elide-graphql/src/main/java/com/yahoo/elide/graphql/QueryRunner.java index b13e53332e..ae9d918fc6 100644 --- a/elide-graphql/src/main/java/com/yahoo/elide/graphql/QueryRunner.java +++ b/elide-graphql/src/main/java/com/yahoo/elide/graphql/QueryRunner.java @@ -71,9 +71,9 @@ public QueryRunner(Elide elide, String apiVersion) { this.apiVersion = apiVersion; NonEntityDictionary nonEntityDictionary = new NonEntityDictionary(); - PersistentResourceFetcher fetcher = new PersistentResourceFetcher(elide.getElideSettings(), - nonEntityDictionary); - ModelBuilder builder = new ModelBuilder(elide.getElideSettings().getDictionary(), nonEntityDictionary, fetcher, apiVersion); + PersistentResourceFetcher fetcher = new PersistentResourceFetcher(nonEntityDictionary); + ModelBuilder builder = new ModelBuilder(elide.getElideSettings().getDictionary(), + nonEntityDictionary, fetcher, apiVersion); this.api = new GraphQL(builder.build()); diff --git a/elide-graphql/src/test/java/com/yahoo/elide/graphql/ModelBuilderTest.java b/elide-graphql/src/test/java/com/yahoo/elide/graphql/ModelBuilderTest.java index 289ff49832..a77a15d26d 100644 --- a/elide-graphql/src/test/java/com/yahoo/elide/graphql/ModelBuilderTest.java +++ b/elide-graphql/src/test/java/com/yahoo/elide/graphql/ModelBuilderTest.java @@ -207,7 +207,7 @@ public void checkAttributeArguments() { dictionary.addArgumentsToAttribute(Book.class, FIELD_PUBLISH_DATE, arguments); DataFetcher fetcher = mock(DataFetcher.class); - ModelBuilder builder = new ModelBuilder(dictionary, fetcher, NO_VERSION); + ModelBuilder builder = new ModelBuilder(dictionary, new NonEntityDictionary(), fetcher, NO_VERSION); GraphQLSchema schema = builder.build(); diff --git a/elide-graphql/src/test/java/com/yahoo/elide/graphql/PersistentResourceFetcherTest.java b/elide-graphql/src/test/java/com/yahoo/elide/graphql/PersistentResourceFetcherTest.java index 2d95298a99..65c3e24e25 100644 --- a/elide-graphql/src/test/java/com/yahoo/elide/graphql/PersistentResourceFetcherTest.java +++ b/elide-graphql/src/test/java/com/yahoo/elide/graphql/PersistentResourceFetcherTest.java @@ -90,7 +90,7 @@ public PersistentResourceFetcherTest() { inMemoryDataStore.populateEntityDictionary(dictionary); NonEntityDictionary nonEntityDictionary = new NonEntityDictionary(); ModelBuilder builder = new ModelBuilder(dictionary, nonEntityDictionary, - new PersistentResourceFetcher(settings, nonEntityDictionary), NO_VERSION); + new PersistentResourceFetcher(nonEntityDictionary), NO_VERSION); api = new GraphQL(builder.build());