Skip to content

@include and @skip directives should exclude content, but instead it's returning null value (except if the directive is applied to the query) #209

@tiagonuneslx

Description

@tiagonuneslx

@skip specs:

The @Skip built-in directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional exclusion during execution as described by the if argument.

@include specs:

The @include built-in directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional inclusion during execution as described by the if argument.

The current implementation differs from the specs, as the content affected by these directives is instead being returned as null.

GraphQL query:

{
  hero {
    name @skip(if: true)
  }
}

Response:

{
  "data": {
    "hero": {
      "name": null
    }
  }
}

This works correctly when the directive is applied to the query itself:

GraphQL query:

{
  hero @skip(if: true) {
    name
  }
}

Response:

{
  "data": {}
}

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