Skip to content
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

@customResolver over fetches fileds not stored in the database #5595

Open
Andy2003 opened this issue Sep 25, 2024 · 1 comment
Open

@customResolver over fetches fileds not stored in the database #5595

Andy2003 opened this issue Sep 25, 2024 · 1 comment
Labels
bug Something isn't working confirmed Confirmed bug

Comments

@Andy2003
Copy link
Contributor

Describe the bug

Given the existing test

test("should not over fetch when other fields are manually selected", async () => {
const query = /* GraphQL */ `
{
users {
firstName
fullName
}
}
`;
const result = await translateQuery(neoSchema, query);
expect(formatCypher(result.cypher)).toMatchInlineSnapshot(`
"MATCH (this:User)
RETURN this { .firstName, .fullName } AS this"
`);
expect(formatParams(result.params)).toMatchInlineSnapshot(`"{}"`);
});

And the documentation

Specifying the @customResolver directive on the field definition keeps fullName from being included in any query or mutation fields and hence as a property on the :User node in the database.

The generated Cypher

MATCH (this:User) RETURN this { .firstName, .fullName } AS this

is wrong, since it includes the filed annotated with @customResolver

Expected cypher should be:

MATCH (this:User) RETURN this { .firstName } AS this
@Andy2003 Andy2003 added the bug Something isn't working label Sep 25, 2024
@darrellwarde darrellwarde added the confirmed Confirmed bug label Sep 30, 2024
@neo4j-team-graphql
Copy link
Collaborator

We've been able to confirm this bug using the steps to reproduce that you provided - many thanks @Andy2003! 🙏 We will now prioritise the bug and address it appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed Confirmed bug
Projects
None yet
Development

No branches or pull requests

3 participants