Support for List type merging
rajankit296 opened this issue · 5 comments
We have gone thought the docs
https://github.com/graph-quilt/graphql-orchestrator-java
https://github.com/graph-quilt/graphql-orchestrator-java
but did not get any details how to fetch data for two services with same unique id.
Getting merging exception.
We have two Services
Service 1 Schema:
`type Query { resourceType: [ResourceType] }
type ResourceType {
name : String # unique key
title: String
}`
Service 2 Schema:
`type Query { resourceType: [ResourceType] }
type ResourceType {
name : String # unique key
version: String
description: String
}`
Exception
`threw exception [Request processing failed; nested exception is com.intuit.graphql.orchestrator.schema.transform.FieldMergeException: Nested fields (parentType:Query, field:resourceType) are not eligible to merge. Reason: Type [name:ResourceType, type:, description:] is not an ObjectType] with root cause
com.intuit.graphql.orchestrator.schema.transform.FieldMergeException: Nested fields (parentType:Query, field:resourceType) are not eligible to merge. Reason: Type [name:ResourceType, type:, description:] is not an ObjectType`
@rajankit296 looking at this issue. Currently List type for nested fields its not supported but we will support it soon.
@rajankit296 We're seeing two interesting concerns here:
- fields with
List
type merging - see my first comment ResourceType
from Service 1 and Service 2 are incompatible types. This document has good explanation: https://www.apollographql.com/docs/federation/federated-types/composition#unresolvable-field-example. There are two path forward for this
a) MakeResourceType
type identical for both services
- Make the types as Entity using
@key
where other subgraphs can extend type and add fields to an entity. Also Service 1 and Service 2 needs to be federation compliant. We support federation in this library.
Thanks @CNAChino for the information. I will go though the doc and try to implement it.
@rajankit296
Please try the below schema.
Service 1 Schema:
type Query {
resourceType: [ResourceType]
}
type ResourceType @key(fields: "name") {
name : String # unique key
title: String
}
Service 2 Schema:
type ResourceType @key(fields: "name") {
name : String
version: String
description: String
}
Additionally, you will also need to
- Change the serviceType to FEDERATION_SUBGRAPH.
- Both Service1 and Service2 are Federation Compliant Subgraph Service.
Thanks @ashpak-shaikh