mhallin / graphql_ppx

GraphQL PPX rewriter for Bucklescript/ReasonML
BSD 3-Clause "New" or "Revised" License
320 stars 42 forks source link

Option to add future-proof "redundant" `Other(value)` in enum? #69

Open sgrove opened 5 years ago

sgrove commented 5 years ago

GraphQL considers adding an enum to be a non-breaking change, because most type systems it seems aren't sound and so the developer always has to include a catch-all. In this world, adding a value to an enum means the old application should (mostly?) keep working, even when it encounters a value it doesn't understand.

Right now, we can't really do that for clients with graphql_ppx. It might be nice to have some option (or even required) to have a catch-all `Other(stringValue) to make apps much safer in the face of GraphQL's "non-breaking" [😄] changes.

baransu commented 5 years ago

I think its really good idea. Would be easy to implement. Maybe should be turned on by default with ability to turn off by some flag.