Skip to content

Error in section 5.3.2 "Field Selection Merging" #450

Closed
@matprec

Description

@matprec

From section 5.3.2 "Field Selection Merging"

  1. If typeA or typeB is Scalar or Enum.
    a. typeA and typeB must be the same type.

  2. Assert: typeA and typeB are both composite types.

  3. Let mergedSet be the result of adding the selection set of fieldA and the selection set of fieldB.

Wouldn't the assertion in 6. contradict 5.a) ? 5. checks if a type is an enum or scalar and if so, ensures that both types are of the same type. It then falls through to 6., which asserts that it both are composite types. If believe that these are incongruous, first of all, because primitive types aren't compositions. Also, scalars (shouldn't this also apply to enums?) cannot contain selection sets per 5.3.3 ("must be empty").

I think it would make sense if the assertion in 6. would be an else and 7.-9. would be indented.

  1. If typeA or typeB is Scalar or Enum.
    a. typeA and typeB must be the same type.

  2. Else: typeA and typeB are both composite types.
    a. Let mergedSet be the result of adding the selection set of fieldA and the selection set of fieldB.
    b. Let fieldsForName be the set of selections with a given response name in mergedSet including visiting fragments and inline fragments.
    c. Given each pair of members subfieldA and subfieldB in fieldsForName:

    • SameResponseShape(subfieldA, subfieldB) must be true.

It could well be that i'm missing something, in which case i want to apologize upfront.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions