-
Notifications
You must be signed in to change notification settings - Fork 2k
[#4169] UniqueInputFieldNamesRule
incorrectly identifies field names as duplicates within and/or array
#4170
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
Conversation
}); | ||
}, | ||
leave() { | ||
knownNamesInList = Object.create([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would also need to use a stack else it would make list --> object --> field --> list lose track of the outer object when it bubbles back up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me address the case of this list --> object --> field --> list
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve changed the approach to use a stack to hold listValue[]
and pop the state when it exits. I’ve also added a test for this case. Could you please help me review it again? @JoviDeCroock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was checking your tests and all of these also pass in current 16.x.x so I don't think this shows any issue in the current shape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but
it('duplicate input object fields in objects of array', () => {
expectErrors(`
{
field(arg: [{Id: {}, Id: {}}])
}
`).toDeepEqual([
{
message: 'There can be only one input field named "Id".',
locations: [
{ line: 3, column: 22 },
{ line: 3, column: 30 },
],
},
]);
});
Correctly reports it as an error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, based on that, I think the issue is with Salesforce rather than the current validation rule. Thank you for your response, thank you for spending time to help me validation again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, happy to help, if anything pops up feel free to reach out/create an issue so we can get to the bottom of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the error query from Salesforce docuemtn https://developer.salesforce.com/docs/platform/graphql/guide/filter-joins.html#multiple-semi-joins-or-anti-joins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, I'll the close PR right now. @JoviDeCroock
Fixed: #4169
To address the issue, use additional variables to store
ListValue
nodes and check if the duplicate field is present in theListValue