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

[RFR] Support for inline fragments for GraphQL Interfaces #3769

Merged
merged 4 commits into from
Nov 27, 2019

Conversation

MichielDeMey
Copy link
Contributor

@MichielDeMey MichielDeMey commented Oct 3, 2019

This PR adds improved support for GraphQL Interface types.

For example if you have the following schema:

interface Device {
  prop1
}

type MotionSensor implements Device {
  prop2
}

type TemperatureSensor implements Device {
  prop3
}

It will now generate the correct inline fragments for the interface when building the GraphQL query.

devices {
  ... on MotionSensor {
    prop1
    prop2
  }
  ... on TemperatureSensor {
    prop1
    prop3
  }
  prop1
}

Allowing you to get prop2 and prop3 from the resource in react-admin.

<TextField source="prop1" />
<TextField source="prop2" />
<TextField source="prop3" />

Note: Requires #3692 and #3712 to be merged

@MichielDeMey MichielDeMey marked this pull request as ready for review October 3, 2019 12:38
@MichielDeMey MichielDeMey changed the title Added support for inline fragments for GraphQL Interfaces [RFR] Added support for inline fragments for GraphQL Interfaces Oct 20, 2019
@MichielDeMey MichielDeMey changed the title [RFR] Added support for inline fragments for GraphQL Interfaces [RFR] Support for inline fragments for GraphQL Interfaces Oct 20, 2019
@fzaninotto
Copy link
Member

New features should be PRed against the next branch, can you please rebase?

@djhi
Copy link
Collaborator

djhi commented Nov 27, 2019

It needs rebase because #3712 has been merged

@djhi
Copy link
Collaborator

djhi commented Nov 27, 2019

@fzaninotto I think this can be merged on master. It's not really a new feature but a better support for existing things in GQL

@fzaninotto
Copy link
Member

Fine, let's merge it on master once it's rebased.

@MichielDeMey
Copy link
Contributor Author

PR rebased to master now. 👍

@fzaninotto
Copy link
Member

but tests fail...

@djhi djhi merged commit eb38bc8 into marmelab:master Nov 27, 2019
@MichielDeMey
Copy link
Contributor Author

Tests have been fixed :)

@djhi
Copy link
Collaborator

djhi commented Nov 27, 2019

Thanks!

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