File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,60 @@ fragment missingRequiredArg on Arguments {
448
448
449
449
### Fragment Declarations
450
450
451
+ #### Fragment Name Uniqueness
452
+
453
+ ** Formal Specification **
454
+
455
+ * For each fragment definition {fragment} in the document
456
+ * Let {fragmentName} be the name of {fragment}.
457
+ * Let {fragments} be all fragment definitions in the document named {fragmentName}.
458
+ * {fragments} must be a set of one.
459
+
460
+ ** Explanatory Text **
461
+
462
+ Fragment definitions are referenced in fragment spreads by name. To avoid
463
+ ambiguity, each fragment's name must be unique within a document.
464
+
465
+ Inline fragments are not considered fragment definitions, and unaffected by this
466
+ validation rule.
467
+
468
+ For example the following document is valid:
469
+
470
+ ``` graphql
471
+ {
472
+ ... fragmentOne
473
+ ... fragmentTwo
474
+ }
475
+
476
+ fragment fragmentOne on Dog {
477
+ name
478
+ }
479
+
480
+ fragment fragmentTwo on Dog {
481
+ owner {
482
+ name
483
+ }
484
+ }
485
+ ```
486
+
487
+ While this document is invalid:
488
+
489
+ ``` graphql
490
+ {
491
+ ... fragmentOne
492
+ }
493
+
494
+ fragment fragmentOne on Dog {
495
+ name
496
+ }
497
+
498
+ fragment fragmentOne on Dog {
499
+ owner {
500
+ name
501
+ }
502
+ }
503
+ ```
504
+
451
505
#### Fragment Spread Type Existence
452
506
453
507
** Formal Specification **
You can’t perform that action at this time.
0 commit comments