nicolasdao / graphql-s2s

Add GraphQL Schema support for type inheritance, generic typing, metadata decoration. Transpile the enriched GraphQL string schema into the standard string schema understood by graphql.js and the Apollo server client.
Other
187 stars 15 forks source link

Inheritance from a Generic Type #35

Closed KeithPepin closed 5 years ago

KeithPepin commented 5 years ago

@nicolasdao thanks for the great library. I've been enjoying how it simplified some recent code I developed at work. I do have a quick question regarding inheritance and generics though. Am I wrong in thinking something like this should work? (currently getting errors when I try with graphql.js):

enum MyEnum {
  option1
  option2
}

type BaseGeneric<T> {
  enumneratedThing: T!
  otherProperty: String
}

type FinalType inherits BaseGeneric<MyEnum> {
  someOtherProperty: String!
}

Which would ideally transpile the FinalType into something like this:

type FinalType {
  enumeratedThing: MyEnum!
  otherProperty: String
  someOtherProperty: String!
}

If this currently isn't supported I have this use case, and would love to see this sort of feature added.

nicolasdao commented 5 years ago

Thanks a lot for reporting this issue @KeithPepin and thanks for detailing your example. We have enough details to work on a fix.

We'll implement that feature asap.

KeithPepin commented 5 years ago

Wonderful @nicolasdao ! I'll look forward to when it is released.

nicolasdao commented 5 years ago

Hi @KeithPepin,

I've just released version 0.20.0 which fixes this issue.

Thanks for reporting that issue.

Cheers,

Nic

KeithPepin commented 5 years ago

Awesome, thanks @nicolasdao !