sangria
sangria copied to clipboard
Support interface to implement other interface
Instead of opening an old issue (#388 & #389) which was closed since GraphQL spec in 2018 didn't support this feature https://github.com/sangria-graphql/sangria/issues/388#issuecomment-407569977 creating a new issue to start the discussion.
GraphQL Spec now allows (since Jan 2020) interface to implement other interfaces as documented here - http://spec.graphql.org/draft/#sec-Interfaces.Interfaces-Implementing-Interfaces
This was merged in the spec by this PR - graphql/graphql-spec#373 and in reference JS implementation by this - graphql/graphql-js#778
Would like to know what contributors' thoughts are wrt to supporting this in Sangria. Do we review #389 or the code has changed enough to warrant a new implementation?
Someone has to take to time to open a new PR (can be based on https://github.com/sangria-graphql/sangria/pull/389) starting from the last version.
Hey @milliondreams we're limited in our contributors right now, but generally speaking, we absolutely would like to keep up with the spec.
I suspect #389 may be old enough that a rebase / merge would be difficult, though we'd welcome a fresh PR.
Additionally, I agree with @OlegIlyenko's review that the original PR got a bit unwieldy to review. Anything that can be done to make the change more targeted would be welcomed greatly.
Is there someone already working on that one? Else I would take a look at the old PR and continue from there and see whether I can put together a PR.
Is there someone already working on that one? Else I would take a look at the old PR and continue from there and see whether I can put together a PR.
I'm not aware of anyone working on that. Thanks for proposing!
I have a question regarding how things are handled in Sangria. In my opinion (and with just copying lot of the examples from the GraphQL JS reference implementation), the following should probably cover most cases. But how do you handle things like the last two situations where in my opinion, the specification right now is not (yet) clear:
interface Being {
name(surname: Boolean): String
}
interface Mammal {
mother: Mammal
father: Mammal
}
interface Pet implements Being {
name(surname: Boolean): String
}
interface Canine implements Mammal & Being {
name(surname: Boolean): String
mother: Canine
father: Canine
}
type Dog implements Being & Pet & Mammal & Canine {
name(surname: Boolean): String
nickname: String
mother: Dog
father: Dog
}
interface Bar {
one: Int
four(argument: String = "string"): String
}
interface Two {
two(argument: String!): Int
}
extend interface Bar implements Two {
two(argument: String!): Int
}
"""
Invalid (already there but as of today, the Spec is not clear about this...)
"""
extend interface Bar implements Two {
three(argument: InputType!): Type
}
"""
Probably Invalid because it's missing Mammal
"""
interface BigCanine implements Canine & Being {
mother: Being # probably invalid
father: BigCanine
}
@titaniumcoder I don't know. Maybe you could ask on https://github.com/graphql/graphql-spec/pull/373 ?
@titaniumcoder are you working on the PR?
@yanns nope, we didn't need it the feature in the end, should have mentioned it, sorry.