Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tiagonuneslx opened this issue Jan 30, 2023 · 0 comments

Comments

@tiagonuneslx
Copy link

@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": {}
}
@tiagonuneslx tiagonuneslx changed the title @include and @skip directives should exclude content, but instead it's resulting in null value (except if it's applied to the query) @include and @skip directives should exclude content, but instead it's resulting null value (except if the directive is applied to the query) Jan 30, 2023
@tiagonuneslx tiagonuneslx changed the title @include and @skip directives should exclude content, but instead it's resulting null value (except if the directive is applied to the query) @include and @skip directives should exclude content, but instead it's returning null value (except if the directive is applied to the query) Jan 30, 2023
tiagonuneslx added a commit to tiagonuneslx/KGraphQL that referenced this issue Feb 5, 2023
… and @Skip directives applied on fields should exclude them, instead of showing them as null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant