Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
23 changes: 23 additions & 0 deletions src/validation/__tests__/DeferStreamDirectiveLabelRule-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ describe('Validate: Defer/Stream directive labels', () => {
`);
});

it('Defer fragment with null label', () => {
expectValid(`
{
dog {
...dogFragmentA @defer(label: null)
}
}
fragment dogFragmentA on Dog {
name
}
`);
});

it('Defer fragment with variable label', () => {
expectErrors(`
query($label: String) {
Expand Down Expand Up @@ -125,6 +138,16 @@ describe('Validate: Defer/Stream directive labels', () => {
}
`);
});
it('Stream with null label', () => {
expectValid(`
{
pets @stream(label: null) {
name
}
}
`);
});

it('Stream with variable label', () => {
expectErrors(`
query ($label: String!) {
Expand Down
2 changes: 1 addition & 1 deletion src/validation/rules/DeferStreamDirectiveLabelRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function DeferStreamDirectiveLabelRule(
(arg) => arg.name.value === 'label',
);
const labelValue = labelArgument?.value;
if (!labelValue) {
if (!labelValue || labelValue.kind === Kind.NULL) {
return;
}
if (labelValue.kind !== Kind.STRING) {
Expand Down
Loading