Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/validation/__tests__/OverlappingFieldsCanBeMerged-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,34 @@ describe('Validate: Overlapping fields can be merged', () => {
);
});

it('allows different args where no conflict is possible on fragments', () => {
// This is valid since no object can be both a "Dog" and a "Cat", thus
// these fields can never overlap.
expectPassesRule(
OverlappingFieldsCanBeMerged,
`
{
pet {
... on Dog {
...X
}
... on Cat {
...Y
}
}
}

fragment X on Pet {
name(surname: true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example currently fails on the Facebook GraphQL server (which does not depend on graphql-js for validation).

I would need to think about this example and whether it can be valid. I'm not sure whether it's a bug in both graphql-js and the Facebook server, or if it's intended behavior.

}

fragment Y on Pet {
name
}
`,
);
});

it('different args, second missing an argument', () => {
expectFailsRule(
OverlappingFieldsCanBeMerged,
Expand Down
Loading