sangria icon indicating copy to clipboard operation
sangria copied to clipboard

Support interface to implement other interface

Open milliondreams opened this issue 4 years ago • 8 comments

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?

milliondreams avatar Jan 21 '21 00:01 milliondreams

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.

yanns avatar Jan 21 '21 16:01 yanns

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.

nickhudkins avatar Jan 21 '21 16:01 nickhudkins

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.

titaniumcoder avatar Feb 02 '21 12:02 titaniumcoder

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!

yanns avatar Feb 02 '21 13:02 yanns

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 avatar Feb 03 '21 18:02 titaniumcoder

@titaniumcoder I don't know. Maybe you could ask on https://github.com/graphql/graphql-spec/pull/373 ?

yanns avatar Jul 20 '21 16:07 yanns

@titaniumcoder are you working on the PR?

yanns avatar Sep 27 '22 21:09 yanns

@yanns nope, we didn't need it the feature in the end, should have mentioned it, sorry.

titaniumcoder avatar Sep 28 '22 03:09 titaniumcoder