nestjs – Graphql Federation composition errors
I am having weird composition errors , composing 3 different subgraphs with apollo federation v2. Subgraph 3 is what i am trying to run with nestjs and getting different errors with different versions of requires directive
Subgraph 1:
type UserDetails @key("id, userType"){
id:string
userType:string
}
Subgraph 2:
type UserDetails @extends @key("id, userType"){
id: String
userType: String
profiles(profileId:String): UserProfiles
}
type UserProfiles() {
selectedProfile: SelectedProfile
}
type SelectedProfile {
profileLocation:String
}
Subgraph 3:
type UserDetails @extends @key(fields:"id, userType"){
id: String
userType: String
profiles: UserProfiles @external
location:[Location] @requires(fields: "id userType profiles(profileId:null){ selectedProfile{profileLocation}}")
}
Errors
Version 1:
error: A valid schema couldn't be composed. The following composition errors were found:[Location] On field "UserDetails.location", for @requires(fields: "id userType profiles(profileId:null){ selectedProfile{profileLocation}}"): Unknown argument "profileId" found in value: "UserDetails.profiles" has no argument named "profileId"
Version 2:
if i don’t provide the profileId parameter in the requires of subgraph 3
Error: A valid schema couldn't be composed. The following composition errors were found:
Field "UserDetails.profiles" is missing argument "UserDetails.profiles(profileId:)" in some subgraphs where it is marked @external: argument "UserDetails.profiles(profileId:)" is declared in subgraphs "Subgraph 2" and "Subgraph 1" but not in subgraphs "Subgraph 3" (where "ProfileDetail.careGivingProfile" is @external)
Read more here: Source link
