-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addRelation: projection not working as expected (with Federation) #370
Comments
It's quite strange. I wrote a test and everything is working as expected. |
Hi @nodkz, Thank you so much for the test. I tried your test and it works. Instead of this: const schema = schemaComposer.buildSchema(); I have this: const typeDefs = gql(schemaComposer.toSDL({ exclude: ['Boolean', 'String', 'Int'] }));
const resolvers = schemaComposer.getResolveMethods();
const federatedSchema = buildSubgraphSchema([{ typeDefs: mergeTypeDefs([typeDefs, customTypeDefs, gql(KeycloakTypeDefs)]) }]);
const schema = addResolversToSchema({
schema: federatedSchema,
resolvers: mergeResolvers([resolvers, customResolvers]),
inheritResolversFromInterfaces: true,
}); When I revert it back to buildSchema as per your test it works. Instead of using buildSubgraphSchema method, I tried with buildFederatedSchema method as well. But issue persists. const schema = buildFederatedSchema([
{ typeDefs: gql(KeycloakTypeDefs) },
{ typeDefs, resolvers: resolvers as any },
{ typeDefs: customTypeDefs, resolvers: customResolvers },
]); Any suggestions on why it is not working with Federation? |
🎉 This issue has been resolved in version 9.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi @nodkz, |
Maybe the federation recreates graphql types under the hood and removes |
I tried the solution #377 (comment) but issue still persists. Is there any update? |
Hi,
I have the following relationship added to UserTC to fetch user's organizations. User schema has the _organizationIds field with list of organization ids.
Execution 01
When querying userFindMany with _organizationIds as a return fields,
QUERY:
RESPONSE:
MONGOOSE LOGS:
_organizationIds: true projection can be found in the query.
Execution 02
When querying userFindMany without _organizationIds as a return fields,
QUERY:
RESPONSE:
MONGOOSE LOGS:
_organizationIds: true projection can not be found in the query and organizations are not getting loaded.
But projection is set to for the required field _organizationIds in the relationship.
Expected behaviour is to fetch _organizationIds automatically obeying to the defined projection.
Please help to resolve this issue.
The text was updated successfully, but these errors were encountered: