federation
federation copied to clipboard
[Federation] Partial Queries - Discussion
Something I'd really like to see for federation is to support partial queries/results. As an example:
federated service 1's SDL might be:
extend union ConfigTypes = OrgCommunicatonsConfig
type OrgCommunicatonsConfig {
canSendMessages: Boolean!,
canSendSMS: Boolean!
}
extend type Query {
getOrgConfig(): [ConfigTypes!] @partial
}
federated service 2's SDL might be:
extend union ConfigTypes = OrgSecurityConfig
type OrgSecurityConfig {
setting1: String!,
setting2: String!
}
extend type Query {
getOrgConfig(): [ConfigTypes!] @partial
}
The resulting schema would be:
union ConfigTypes = OrgSecurityConfig | OrgCommunicatonsConfig
type OrgSecurityConfig {
setting1: String!,
setting2: String!
}
type OrgCommunicatonsConfig {
canSendMessages: Boolean!,
canSendSMS: Boolean!
}
type Query {
getOrgConfig(): [ConfigTypes!]
}
The query executor would then forward any query to getOrgConfig to each service and then amalgamate the results so you can then do something like:
query {
getOrgConfig() {
... on OrgSecurityConfig {
/// query fields
}
... on OrgCommunicatonsConfig {
/// query fields
}
}
}
I'm looking for something just like this. Did this ever get implemented?