gql icon indicating copy to clipboard operation
gql copied to clipboard

Interfaces cannot implement other interfaces

Open ValentinVignal opened this issue 2 years ago • 3 comments

I'm generating my schema.graphql file with nestjs graphql: https://github.com/nestjs/graphql which supports interfaces implementing other interfaces:

interface Interface0 {
   field0: String
}

interface Interface1 implements Interface0 {
   field0: String
   field1: Float!
}

interface Interface2 implements Interface0 & Interface1 {
   field0: String
   field1: Float!
   field2: Float
}

type Type0 implements & Interface0 & Interface1 & Interface2 {
   field0: String
   field1: Float!
   field2: Float
}

But it looks like it is not supported by this package:

Error on line xx, column yy of package:my_project/schema.graphql: Unknown definition type 'implements'
   ╷
16 │ interface Interface2 implements Interface0 & Interface1 {
   │                      ^^^^^^^^^^
   ╵

(Right now, I'm using the version 0.9.4) Is there something I should do to make it work, or is it planned to support it in the future?

ValentinVignal avatar Sep 24 '21 04:09 ValentinVignal

First of all, I moved this to the gql repo since it relates to the gql/language code, not ferry directly.

The feature of interfaces implementing other interfaces hasn't made it into the official GraphQL spec yet.

They are included in the current working draft though, so we can reasonably expect them in the next official spec release. As such, I think it would be reasonable to just go ahead and implement this feature now.

I don't have the time to work on this, but I can provide guidance if you'd like to make a PR, or maybe one of the other maintainers of gql wants to take it on.

smkhalsa avatar Sep 24 '21 08:09 smkhalsa

Awesome ,I'm very glad to hear that. Thank you for this quick response. I don't have the time to work on it right now though. I might give it a try in a while if no one started in the meantime.

ValentinVignal avatar Sep 24 '21 09:09 ValentinVignal

Would be great to add support for this, it is now part of the official spec since October 2021.

tlvenn avatar Apr 04 '22 14:04 tlvenn