Hey Team, I got the following error which is relat...
# troubleshoot
r
Hey Team, I got the following error which is related to GraphQL.
Copy code
{errors=[The object type 'DataDoc' [@3117:1] does not have a field 'relationships' required via interface 'Entity' [@297:1], There is no type resolver defined for interface / union 'DataDocCell' type]}
Any suggestions about how to fix it?
Copy code
SchemaProblem{errors=[The object type 'DataDoc' [@3117:1] does not have a field 'relationships' required via interface 'Entity' [@297:1], There is no type resolver defined for interface / union 'DataDocCell' type]}
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:74)
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:52)
        at com.linkedin.datahub.graphql.GraphQLEngine.<init>(GraphQLEngine.java:57)
        at com.linkedin.datahub.graphql.GraphQLEngine.<init>(GraphQLEngine.java:35)
        at com.linkedin.datahub.graphql.GraphQLEngine$Builder.build(GraphQLEngine.java:158)
        at com.linkedin.gms.factory.graphql.GraphQLEngineFactory.getInstance(GraphQLEngineFactory.java:104)
        at com.linkedin.gms.factory.graphql.GraphQLEngineFactory$$EnhancerBySpringCGLIB$$42809780.CGLIB$getInstance$0(<generated>)
        at com.linkedin.gms.factory.graphql.GraphQLEngineFactory$$EnhancerBySpringCGLIB$$42809780$$FastClassBySpringCGLIB$$68814c19.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
        at com.linkedin.gms.factory.graphql.GraphQLEngineFactory$$EnhancerBySpringCGLIB$$42809780.getInstance(<generated>)
b
Inside of GmsGraphQLEngine.java you must attach a "relationships" resolver, like we do for Dataset, Chart, Dashboard etc inside a
configureDataDocResolver
method... Related: We've updated the docs to be a bit cleared based on your feedback!: https://datahubproject.io/docs/datahub-graphql-core & https://datahubproject.io/docs/metadata-service However, we should also add this!!
r
Looks like there are two errors in the above log: 1. need an extra field,
relationships
2. need an resolver for union 'DataDocCell' type I added the following field in my new entity definition, the first error is fixed
Copy code
"""
    Edges extending from this entity
    """
    relationships(input: RelationshipsInput!): EntityRelationshipsResult
But the second one still exist
I did this to make datahub-gms service running. But I have no idea why this helps
Copy code
diff --git a/datahub-graphql-core/src/main/resources/entity.graphql b/datahub-graphql-core/src/main/resources/entity.graphql
index bf1a47c3e..ffa3f85b0 100644
--- a/datahub-graphql-core/src/main/resources/entity.graphql
+++ b/datahub-graphql-core/src/main/resources/entity.graphql
@@ -3177,6 +3177,11 @@ type DataDoc implements Entity {
     The Domain associated with the DataDoc
     """
     domain: Domain
+
+    """
+    Edges extending from this entity
+    """
+    relationships(input: RelationshipsInput!): EntityRelationshipsResult
 }
 
 """
@@ -3192,7 +3197,11 @@ type DataDocContent {
 """
 The Union of every DataDocCell
 """
-union DataDocCell = ChartCell | TextCell | QueryCell
+type DataDocCell {
+    chartCell: ChartCell
+    textCell: TextCell
+    queryChell: QueryCell
+}
Hey @big-carpet-38439, some feedback after implementing the GraphQL related logic after adding the new entity type. I found there is a lot of copy-paste code for each
EntityType
I would like to suggest some refactor to reduce the duplicated code 🙂
b
Yesss!! Please! We don't have anyone spending a ton of time on that piece right now 😛
r
Sorry for the confusion. What I mean is we should do some refactor to reduce the duplicated code. Only got some brief idea. I might do something on my background thread. (Since it's not a blocker for us, the process will be slow 😂)
Hi John, Since this page does not mention that I need to modify
EntityTypeMapper
class if I added a new entity type, I think I do not need to change
ENTITY_TYPE_TO_NAME
, right?
b
Yes for a new entity type 😞
I need to add that!