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

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

Merged
merged 1 commit into from
Oct 2, 2015

Conversation

leebyron
Copy link
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
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.

None yet

3 participants