-
Notifications
You must be signed in to change notification settings - Fork 2k
RFC: Allow interfaces to implement other interfaces #2084
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: Allow interfaces to implement other interfaces #2084
Conversation
It looks like I can't request particular reviewers, so I'm just tagging @mjmahone and @michaelstaib in case you weren't notified already. The PR is incredibly simple but touches many pieces of code (especially tests). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this seems like a pretty minimal change for what we want to do. I like this direction a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mike-marcacci As agreed during WG there are two additional requirements:
- Validation that prevents cycles in interface hierarchies
- Blog post explaining motivation and scope of this feature.
@mike-marcacci If you want I can help with cycle validation? I think we can generalize code from #1359 to also validate interfaces.
@IvanGoncharov I've added logic to prevent cyclic implementations. Because we already require flattening of transitively implemented interfaces, this ended up being trivial and didn't require any recursion. I believe this is in its final state. I'm going to write up a blog post today, but this PR can probably be merged without it. Does anyone have a preference on how/where I publish the post? I can publish it myself on Medium after this is merged, or create a PR to the GraphQL blog. |
@mike-marcacci I think publishing it on personal account would be enough. Also can you please update TS typings in
Great 🎉 I'm currently in the middle of review: |
Wonderful! Great catch on the TS types; I just added those. |
@mike-marcacci Currently we are in feature freeze for I branch of |
Thanks so much for the thorough review @IvanGoncharov! I just rebased this on top of master. 👍 I also added a |
@mike-marcacci Sorry for the delay I was traveling to a conference and speaking today. |
@IvanGoncharov no worries at all! You're an absolute hero for all your work here :) |
This is part of the update to allow interfaces to implement interfaces. A single extend statement to add an implementation of an interface without field declarations is valid. This was caught by tests and brings in a change from graphql/graphql-js#2084
This is part of the update to allow interfaces to implement interfaces. A single extend statement to add an implementation of an interface without field declarations is valid. This was caught by tests and brings in a change from graphql/graphql-js#2084
This is part of the update to allow interfaces to implement interfaces. A single extend statement to add an implementation of an interface without field declarations is valid. This was caught by tests and brings in a change from graphql/graphql-js#2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084
* Implement support for interfaces implementing interfaces Closes #728 * Implement tests for interfaces implementing interfaces This ports the JavaScript tests for `RFC: Allow interfaces to implement other interfaces` to PHP. This should ensure that there is sufficient test coverage for the changes made to support interfaces implementing interfaces. Tests taken from https://github.com/graphql/graphql-js/pull/2084/files including any typoes in test description strings to aid in comparison. * Fix extend implement interface in Parser This is part of the update to allow interfaces to implement interfaces. A single extend statement to add an implementation of an interface without field declarations is valid. This was caught by tests and brings in a change from graphql/graphql-js#2084 * Validate interface implemented ancestors Part of the work done to implement interfaces implementing interfaces. This was caught by test and improves on the previously done changes for the SchemaValidationContext by implementing `validateTypeImplementsAncestors` which was missing. * Properly apply Schema changes for interface extension support This redoes the work done for the Schema class since it was previously guessed at. It now more closely follows graphql/graphql-js/pull/2084 * Improve interface extension related typehints Co-authored-by: Benedikt Franke <[email protected]> * Refine types * Remove complex array shape type * Don't remove but deprecate DANGEROUS_CHANGE_IMPLEMENTED_INTERFACE_ADDED Removing a public constant is a breaking change and can not be implemented in a minor version. Instead the internal value is changed to ensure that existing code keeps working with the new interface implementation logic. * Don't remove but deprecate BREAKING_CHANGE_INTERFACE_REMOVED_FROM_OBJECT Co-authored-by: Benedikt Franke <[email protected]> Co-authored-by: Benedikt Franke <[email protected]>
This is an implementation of the RFC described by spec PR graphql/graphql-spec#373
This is a successor to PR #1218 which had accumulated too many merge conflicts to bother fixing.