Skip to content

Return the highest complexity of nested fragments when using a UnionType or Interfaces #26

@dmateiu

Description

@dmateiu

When using UnionType or Interfaces, the current implementation is returning the sum of all nested fragments.

As the types of the conditional fragments are mutually exclusive, I would not expect the complexities to be added up.

I would suggest using the complexity of the highest nested fragment.

Example:

      query {
        union {
          ...on Item { // assume complexity 22
            scalar
            complexScalar
          }
          ...on SecondItem { // assume complexity 2
            name
            scalar
          }
         value // assume complexity 1
        }
      }
    `

I would expect the resulting complexity to be 23.

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