ts2gql icon indicating copy to clipboard operation
ts2gql copied to clipboard

Support for GraphQL Required

Open FelipeCoimbra opened this issue 6 years ago • 3 comments

I am opening a new issue since the other one (#4) is old and I haven't received any response in the discussion. ts2gql is great but there are a lot of features of the GraphQL SDL that it does not support yet. Required is an essential feature and it would be great to exist support from the original repo.

I believe the most correct approach would be to create a NonNull node as a Wrapping Type and make everything required by default. This combines with the specification of TypeScript that declaring a function parameter requires the function to have this parameter and declaring an interface property requires it's not undefined (unless stated). Unions with null and undefined and ? marks would mark it as not required.

I'm up to implement this feature and submit a PR

FelipeCoimbra avatar Jan 28 '19 17:01 FelipeCoimbra

Yeah; I think this would be very valuable and we'd accept a PR about it (please make it an optional thing, though; since it's potentially a big migration for people)

nevir avatar Jan 28 '19 19:01 nevir

Wouldn't it be better to release a new minor (new major would actually be better suited) than creating one single optional flag?

FelipeCoimbra avatar Jan 28 '19 20:01 FelipeCoimbra

There will likely be other changes added after this one, and we shouldn't expect/force everyone to migrate to the new approach just to pick them up.

I know it'd take quite a while for us to migrate all our usages over

nevir avatar Jan 29 '19 00:01 nevir