Skip to content

Commit d1963dd

Browse files
twofyaacovCR
authored andcommitted
Remove CCN (graphql#3999)
We're winding down work on CCN in favor of True Schema Nullability. More context: graphql/nullability-wg#37
1 parent 9d805f6 commit d1963dd

16 files changed

Lines changed: 9 additions & 719 deletions

src/__testUtils__/kitchenSinkQuery.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@ query queryName(
1515
...frag @onFragmentSpread
1616
}
1717
}
18-
19-
field3!
20-
field4?
21-
requiredField5: field5!
22-
requiredSelectionSet(first: 10)! @directive {
23-
field
24-
}
25-
26-
unsetListItemsRequiredList: listField[]!
27-
requiredListItemsUnsetList: listField[!]
28-
requiredListItemsRequiredList: listField[!]!
29-
unsetListItemsOptionalList: listField[]?
30-
optionalListItemsUnsetList: listField[?]
31-
optionalListItemsOptionalList: listField[?]?
32-
multidimensionalList: listField[[[!]!]!]!
3318
}
3419
... @skip(unless: $foo) {
3520
id

src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ export {
232232
isDefinitionNode,
233233
isExecutableDefinitionNode,
234234
isSelectionNode,
235-
isNullabilityAssertionNode,
236235
isValueNode,
237236
isConstValueNode,
238237
isTypeNode,
@@ -266,10 +265,6 @@ export type {
266265
FieldNode,
267266
ArgumentNode,
268267
FragmentArgumentNode,
269-
NullabilityAssertionNode,
270-
NonNullAssertionNode,
271-
ErrorBoundaryNode,
272-
ListNullabilityOperatorNode,
273268
ConstArgumentNode,
274269
FragmentSpreadNode,
275270
InlineFragmentNode,

src/language/__tests__/lexer-test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -944,13 +944,6 @@ describe('Lexer', () => {
944944
value: undefined,
945945
});
946946

947-
expect(lexOne('?')).to.contain({
948-
kind: TokenKind.QUESTION_MARK,
949-
start: 0,
950-
end: 1,
951-
value: undefined,
952-
});
953-
954947
expect(lexOne('$')).to.contain({
955948
kind: TokenKind.DOLLAR,
956949
start: 0,
@@ -1196,7 +1189,6 @@ describe('isPunctuatorTokenKind', () => {
11961189

11971190
it('returns true for punctuator tokens', () => {
11981191
expect(isPunctuatorToken('!')).to.equal(true);
1199-
expect(isPunctuatorToken('?')).to.equal(true);
12001192
expect(isPunctuatorToken('$')).to.equal(true);
12011193
expect(isPunctuatorToken('&')).to.equal(true);
12021194
expect(isPunctuatorToken('(')).to.equal(true);

src/language/__tests__/parser-test.ts

Lines changed: 1 addition & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ import {
2121
import { Source } from '../source.js';
2222
import { TokenKind } from '../tokenKind.js';
2323

24-
function parseCCN(source: string) {
25-
return parse(source, { experimentalClientControlledNullability: true });
26-
}
27-
2824
function expectSyntaxError(text: string) {
2925
return expectToThrowJSON(() => parse(text));
3026
}
@@ -184,7 +180,7 @@ describe('Parser', () => {
184180
});
185181

186182
it('parses kitchen sink', () => {
187-
expect(() => parseCCN(kitchenSinkQuery)).to.not.throw();
183+
expect(() => parse(kitchenSinkQuery)).to.not.throw();
188184
});
189185

190186
it('allows non-keywords anywhere a Name is allowed', () => {
@@ -255,206 +251,6 @@ describe('Parser', () => {
255251
).to.not.throw();
256252
});
257253

258-
it('parses required field', () => {
259-
const result = parseCCN('{ requiredField! }');
260-
261-
expectJSON(result).toDeepNestedProperty(
262-
'definitions[0].selectionSet.selections[0].nullabilityAssertion',
263-
{
264-
kind: Kind.NON_NULL_ASSERTION,
265-
loc: { start: 15, end: 16 },
266-
nullabilityAssertion: undefined,
267-
},
268-
);
269-
});
270-
271-
it('parses optional field', () => {
272-
expect(() => parseCCN('{ optionalField? }')).to.not.throw();
273-
});
274-
275-
it('does not parse field with multiple designators', () => {
276-
expect(() => parseCCN('{ optionalField?! }')).to.throw(
277-
'Syntax Error: Expected Name, found "!".',
278-
);
279-
280-
expect(() => parseCCN('{ optionalField!? }')).to.throw(
281-
'Syntax Error: Expected Name, found "?".',
282-
);
283-
});
284-
285-
it('parses required with alias', () => {
286-
expect(() => parseCCN('{ requiredField: field! }')).to.not.throw();
287-
});
288-
289-
it('parses optional with alias', () => {
290-
expect(() => parseCCN('{ requiredField: field? }')).to.not.throw();
291-
});
292-
293-
it('does not parse aliased field with bang on left of colon', () => {
294-
expect(() => parseCCN('{ requiredField!: field }')).to.throw();
295-
});
296-
297-
it('does not parse aliased field with question mark on left of colon', () => {
298-
expect(() => parseCCN('{ requiredField?: field }')).to.throw();
299-
});
300-
301-
it('does not parse aliased field with bang on left and right of colon', () => {
302-
expect(() => parseCCN('{ requiredField!: field! }')).to.throw();
303-
});
304-
305-
it('does not parse aliased field with question mark on left and right of colon', () => {
306-
expect(() => parseCCN('{ requiredField?: field? }')).to.throw();
307-
});
308-
309-
it('does not parse designator on query', () => {
310-
expect(() => parseCCN('query? { field }')).to.throw();
311-
});
312-
313-
it('parses required within fragment', () => {
314-
expect(() =>
315-
parseCCN('fragment MyFragment on Query { field! }'),
316-
).to.not.throw();
317-
});
318-
319-
it('parses optional within fragment', () => {
320-
expect(() =>
321-
parseCCN('fragment MyFragment on Query { field? }'),
322-
).to.not.throw();
323-
});
324-
325-
it('parses field with required list elements', () => {
326-
const result = parseCCN('{ field[!] }');
327-
328-
expectJSON(result).toDeepNestedProperty(
329-
'definitions[0].selectionSet.selections[0].nullabilityAssertion',
330-
{
331-
kind: Kind.LIST_NULLABILITY_OPERATOR,
332-
loc: { start: 7, end: 10 },
333-
nullabilityAssertion: {
334-
kind: Kind.NON_NULL_ASSERTION,
335-
loc: { start: 8, end: 9 },
336-
nullabilityAssertion: undefined,
337-
},
338-
},
339-
);
340-
});
341-
342-
it('parses field with optional list elements', () => {
343-
const result = parseCCN('{ field[?] }');
344-
345-
expectJSON(result).toDeepNestedProperty(
346-
'definitions[0].selectionSet.selections[0].nullabilityAssertion',
347-
{
348-
kind: Kind.LIST_NULLABILITY_OPERATOR,
349-
loc: { start: 7, end: 10 },
350-
nullabilityAssertion: {
351-
kind: Kind.ERROR_BOUNDARY,
352-
loc: { start: 8, end: 9 },
353-
nullabilityAssertion: undefined,
354-
},
355-
},
356-
);
357-
});
358-
359-
it('parses field with required list', () => {
360-
const result = parseCCN('{ field[]! }');
361-
362-
expectJSON(result).toDeepNestedProperty(
363-
'definitions[0].selectionSet.selections[0].nullabilityAssertion',
364-
{
365-
kind: Kind.NON_NULL_ASSERTION,
366-
loc: { start: 7, end: 10 },
367-
nullabilityAssertion: {
368-
kind: Kind.LIST_NULLABILITY_OPERATOR,
369-
loc: { start: 7, end: 9 },
370-
nullabilityAssertion: undefined,
371-
},
372-
},
373-
);
374-
});
375-
376-
it('parses field with optional list', () => {
377-
const result = parseCCN('{ field[]? }');
378-
379-
expectJSON(result).toDeepNestedProperty(
380-
'definitions[0].selectionSet.selections[0].nullabilityAssertion',
381-
{
382-
kind: Kind.ERROR_BOUNDARY,
383-
loc: { start: 7, end: 10 },
384-
nullabilityAssertion: {
385-
kind: Kind.LIST_NULLABILITY_OPERATOR,
386-
loc: { start: 7, end: 9 },
387-
nullabilityAssertion: undefined,
388-
},
389-
},
390-
);
391-
});
392-
393-
it('parses multidimensional field with mixed list elements', () => {
394-
const result = parseCCN('{ field[[[?]!]]! }');
395-
396-
expectJSON(result).toDeepNestedProperty(
397-
'definitions[0].selectionSet.selections[0].nullabilityAssertion',
398-
{
399-
kind: Kind.NON_NULL_ASSERTION,
400-
loc: { start: 7, end: 16 },
401-
nullabilityAssertion: {
402-
kind: Kind.LIST_NULLABILITY_OPERATOR,
403-
loc: { start: 7, end: 15 },
404-
nullabilityAssertion: {
405-
kind: Kind.LIST_NULLABILITY_OPERATOR,
406-
loc: { start: 8, end: 14 },
407-
nullabilityAssertion: {
408-
kind: Kind.NON_NULL_ASSERTION,
409-
loc: { start: 9, end: 13 },
410-
nullabilityAssertion: {
411-
kind: Kind.LIST_NULLABILITY_OPERATOR,
412-
loc: { start: 9, end: 12 },
413-
nullabilityAssertion: {
414-
kind: Kind.ERROR_BOUNDARY,
415-
loc: { start: 10, end: 11 },
416-
nullabilityAssertion: undefined,
417-
},
418-
},
419-
},
420-
},
421-
},
422-
},
423-
);
424-
});
425-
426-
it('does not parse field with unbalanced brackets', () => {
427-
expect(() => parseCCN('{ field[[] }')).to.throw(
428-
'Syntax Error: Expected "]", found "}".',
429-
);
430-
431-
expect(() => parseCCN('{ field[]] }')).to.throw(
432-
'Syntax Error: Expected Name, found "]".',
433-
);
434-
435-
expect(() => parse('{ field] }')).to.throw(
436-
'Syntax Error: Expected Name, found "]".',
437-
);
438-
439-
expect(() => parseCCN('{ field[ }')).to.throw(
440-
'Syntax Error: Expected "]", found "}".',
441-
);
442-
});
443-
444-
it('does not parse field with assorted invalid nullability designators', () => {
445-
expect(() => parseCCN('{ field[][] }')).to.throw(
446-
'Syntax Error: Expected Name, found "[".',
447-
);
448-
449-
expect(() => parseCCN('{ field[!!] }')).to.throw(
450-
'Syntax Error: Expected "]", found "!".',
451-
);
452-
453-
expect(() => parseCCN('{ field[]?! }')).to.throw(
454-
'Syntax Error: Expected Name, found "!".',
455-
);
456-
});
457-
458254
it('creates ast', () => {
459255
const result = parse(dedent`
460256
{
@@ -506,7 +302,6 @@ describe('Parser', () => {
506302
loc: { start: 9, end: 14 },
507303
},
508304
],
509-
nullabilityAssertion: undefined,
510305
directives: [],
511306
selectionSet: {
512307
kind: Kind.SELECTION_SET,
@@ -522,7 +317,6 @@ describe('Parser', () => {
522317
value: 'id',
523318
},
524319
arguments: [],
525-
nullabilityAssertion: undefined,
526320
directives: [],
527321
selectionSet: undefined,
528322
},
@@ -536,7 +330,6 @@ describe('Parser', () => {
536330
value: 'name',
537331
},
538332
arguments: [],
539-
nullabilityAssertion: undefined,
540333
directives: [],
541334
selectionSet: undefined,
542335
},
@@ -585,7 +378,6 @@ describe('Parser', () => {
585378
value: 'node',
586379
},
587380
arguments: [],
588-
nullabilityAssertion: undefined,
589381
directives: [],
590382
selectionSet: {
591383
kind: Kind.SELECTION_SET,
@@ -601,7 +393,6 @@ describe('Parser', () => {
601393
value: 'id',
602394
},
603395
arguments: [],
604-
nullabilityAssertion: undefined,
605396
directives: [],
606397
selectionSet: undefined,
607398
},
@@ -656,7 +447,6 @@ describe('Parser', () => {
656447
value: 'node',
657448
},
658449
arguments: [],
659-
nullabilityAssertion: undefined,
660450
directives: [],
661451
selectionSet: {
662452
kind: Kind.SELECTION_SET,
@@ -672,7 +462,6 @@ describe('Parser', () => {
672462
value: 'id',
673463
},
674464
arguments: [],
675-
nullabilityAssertion: undefined,
676465
directives: [],
677466
selectionSet: undefined,
678467
},
@@ -1290,7 +1079,6 @@ describe('Parser', () => {
12901079
loc: { start: 150, end: 155 },
12911080
},
12921081
],
1293-
nullabilityAssertion: undefined,
12941082
directives: [],
12951083
selectionSet: undefined,
12961084
loc: { start: 137, end: 156 },

src/language/__tests__/predicates-test.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
isConstValueNode,
99
isDefinitionNode,
1010
isExecutableDefinitionNode,
11-
isNullabilityAssertionNode,
1211
isSchemaCoordinateNode,
1312
isSelectionNode,
1413
isTypeDefinitionNode,
@@ -64,14 +63,6 @@ describe('AST node predicates', () => {
6463
]);
6564
});
6665

67-
it('isNullabilityAssertionNode', () => {
68-
expect(filterNodes(isNullabilityAssertionNode)).to.deep.equal([
69-
'ListNullabilityOperator',
70-
'NonNullAssertion',
71-
'ErrorBoundary',
72-
]);
73-
});
74-
7566
it('isValueNode', () => {
7667
expect(filterNodes(isValueNode)).to.deep.equal([
7768
'Variable',

0 commit comments

Comments
 (0)