-
Notifications
You must be signed in to change notification settings - Fork 527
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
Allow interface fields to reference other interfaces (#1089) #1091
Allow interface fields to reference other interfaces (#1089) #1091
Conversation
c4ecc82
to
61c0112
Compare
61c0112
to
0b62790
Compare
@binaryseed not sure if you're able to have a look, but I would love your input! |
It be cool to see this merged in soon! Looking forward to seeing this functionality. |
@@ -191,6 +191,18 @@ defmodule Absinthe.Phase.Schema.Validation.ObjectMustImplementInterfaces do | |||
:ok | |||
end | |||
|
|||
defp check_covariant( | |||
%Blueprint.TypeReference.Name{name: iface_name}, | |||
%Blueprint.TypeReference.Name{name: type_name}, |
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.
Ahh, I suspect the difference between the SDL & DSL is that only SDL currently generates the TypeReference
blueprint structs everywhere... DSL winds up with bare-atom identifiers
This is a related note from a while back: #783
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.
You're exactly right! Thats what I was seeing, just a bare atom in the case of the DSL.
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.
ooh nice find
Closes #1089
It appears the DSL and the
import_sdl
differ in how interface types, with fields that themselves interfaces types, are compiled. When creating schemas via the DSL, compilation works as intended. I can create an interface that contains a field that is another interface type. When I do the same viaimport_sdl
, compilation fails because it Absinthe thinks that the interface is not fully adhered to. This attempts to patch that behavior to ensure interface types can have fields that are themselves interfaces.To ensure this use case is valid according to the GraphQL spec, I created a minimal reproduction of this schema using GraphQL.js to validate whether the SDL or the DSL had the correct behavior. It does indeed appear that interface types are allowed as fields to other interface types.