Skip to content

[RFC] Type condition optional on inline fragments.#100

Merged
leebyron merged 1 commit intomasterfrom
inline-fragment-op-type
Oct 2, 2015
Merged

[RFC] Type condition optional on inline fragments.#100
leebyron merged 1 commit intomasterfrom
inline-fragment-op-type

Conversation

@leebyron
Copy link
Copy Markdown
Collaborator

@leebyron leebyron commented Oct 1, 2015

Originally proposed by @josephsavona, this allows inline fragments to omit a type condition and thus always be considered for inclusion. If a type condition is omitted, no type refinement is done to the contained fields.

This enables a new kind of usecase where the only purpose for using an inline fragment is applying a directive to a grouping of fields:

fragment Foo on Type {
  fieldA
  fieldB
  ... @include(if: $wat) {
    fieldC
    fieldD
  }
}

Originally proposed by @josephsavona, this allows inline fragments to omit a type condition and thus always be considered for inclusion. If a type condition is omitted, no type refinement is done to the contained fields.

This enables a new kind of usecase where the only purpose for using an inline fragment is applying a directive to a grouping of fields:

```graphql
fragment Foo on Type {
  fieldA
  fieldB
  ... @include(if: $wat) {
    fieldC
    fieldD
  }
}
```
@josephsavona
Copy link
Copy Markdown
Contributor

ship it!

leebyron added a commit to graphql/graphql-js that referenced this pull request Oct 2, 2015
leebyron added a commit that referenced this pull request Oct 2, 2015
[RFC] Type condition optional on inline fragments.
@leebyron leebyron merged commit 435ad86 into master Oct 2, 2015
@leebyron leebyron deleted the inline-fragment-op-type branch October 2, 2015 01:13
jhgg added a commit to graphql-python/graphql-core-legacy that referenced this pull request Oct 6, 2015
sogko added a commit to sogko/graphql that referenced this pull request Mar 8, 2016
Parents: 529257b8d3
Author: Lee Byron <lee@leebyron.com>
Date: 2 October 2015 at 9:10:21 AM SGT

[RFC] Type condition optional on inline fragments.

Implements graphql/graphql-spec#100
mattstern31 pushed a commit to mattstern31/graphql-gqllero-repository that referenced this pull request Nov 10, 2022
Parents: 529257b8d3
Author: Lee Byron <lee@leebyron.com>
Date: 2 October 2015 at 9:10:21 AM SGT

[RFC] Type condition optional on inline fragments.

Implements graphql/graphql-spec#100
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

Successfully merging this pull request may close these issues.

3 participants