This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-3676 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 2bf2c4f1c541fa0e197d646137d1c402da750d71 Author: danhaywood <[email protected]> AuthorDate: Sat Jan 20 16:48:34 2024 +0000 CAUSEWAY-3676: minor reordering of registering types --- .../causeway/viewer/graphql/model/domain/GqlvDomainObject.java | 9 +++++++++ .../graphql/viewer/integration/GraphQlSourceForCauseway.java | 9 ++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java b/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java index 8916e4d46f..ee447335e5 100644 --- a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java +++ b/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java @@ -21,6 +21,7 @@ import org.apache.causeway.core.metamodel.spec.feature.ObjectAssociation; import org.apache.causeway.core.metamodel.spec.feature.OneToManyAssociation; import org.apache.causeway.core.metamodel.spec.feature.OneToOneAssociation; import org.apache.causeway.core.metamodel.specloader.SpecificationLoader; +import org.apache.causeway.viewer.graphql.model.registry.GraphQLTypeRegistry; import org.apache.causeway.viewer.graphql.model.types._Constants; import org.apache.causeway.viewer.graphql.model.util._LTN; import org.apache.causeway.viewer.graphql.model.types.TypeMapper; @@ -417,4 +418,12 @@ public class GqlvDomainObject { return mutatorsType; } + public void addTypesInto(GraphQLTypeRegistry graphQLTypeRegistry) { + + graphQLTypeRegistry.addTypeIfNotAlreadyPresent(getMeta().getMetaField().getType()); + graphQLTypeRegistry.addTypeIfNotAlreadyPresent(getGqlInputObjectType()); + + getMutatorsTypeIfAny().ifPresent(graphQLTypeRegistry::addTypeIfNotAlreadyPresent); + } + } diff --git a/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java b/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java index 8b111b96a1..353e911cc5 100644 --- a/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java +++ b/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java @@ -203,17 +203,12 @@ public class GraphQlSourceForCauseway implements GraphQlSource { gqlvDomainObject.addCollectionsAsLists(); gqlvDomainObject.addActionsAsFields(); - - graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlvDomainObject.getMeta().getMetaField().getType()); - graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlvDomainObject.getGqlInputObjectType()); - - gqlvDomainObject.getMutatorsTypeIfAny() - .ifPresent(graphQLTypeRegistry::addTypeIfNotAlreadyPresent); - // build and register object type GraphQLObjectType graphQLObjectType = gqlvDomainObject.buildGqlObjectType(); graphQLTypeRegistry.addTypeIfNotAlreadyPresent(graphQLObjectType); + gqlvDomainObject.addTypesInto(graphQLTypeRegistry); + // create and register data fetchers gqlvDomainObject.addDataFetchersForMetaData(); gqlvDomainObject.addDataFetchersForMutators();
