Martmists-GH / Martmists-GH/multiplatform-everything

[GraphQL] Support @skip and @include directives

Open
#10 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Kotlin
Stars
10
Forks
2
PR merge metrics
No merged PRs in 30d

Description

https://spec.graphql.org/October2021/#sec-Type-System.Directives

skip
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT

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.

In this example experimentalField will only be queried if the variable
$someTest has the value false.

query myQuery($someTest: Boolean!) {
  experimentalField @skip(if: $someTest)
}
include
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT

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.

In this example experimentalField will only be queried if the variable
$someTest has the value true

query myQuery($someTest: Boolean!) {
  experimentalField @include(if: $someTest)
}

Note: Neither @skip nor @include has precedence over the other. In the case
that both the @skip and @include directives are provided on the same
field or fragment, it must be queried only if the @skip condition is false
and the @include condition is true. Stated conversely, the field or fragment
must not be queried if either the @skip condition is true or the
@include condition is false.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked October 2021 GraphQL specification sections for the built-in @skip and @include directives. Trace the repository's GraphQL directive validation and execution entry points, then verify that fields, fragment spreads, and inline fragments follow both conditions and the stated combined behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, kotlin
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.