Comments (5)
First; I agree this should be togglable. I think enums might already be possible to toggle globally via the Relay compiler and some option whose name I can't remember, but that's for "future proof enums". You can also set the behaviour per field via @rescriptRelayAllowUnsafeEnum
.
Docs mention having exhaustive enums and unions is unsafe due to possible gaps between server/client releases. In the case of React Native or web apps with service workers, it makes sense. But in the case of traditional web apps, I would argue the risks are relatively low. And if an app implements version checking (eg, via headers), there is no risk at all.
Anecdotal, but I've actually worked at multiple places where the main product was a web app, where we'd regularly have a tail of 3+ month old web clients still making requests, because people never close the tab nor refresh the page.
But in the case of enums, _ it might hurt.
This was a trade off that was made a few years back. This is actually solved in V3 where enums are regular variants with a built-in catch all FutureAddedValue(_)
. So you get both, handling the catch all case and the compiler tells you where to handle new members.
So to sum it up, I agree, it should be togglable. We'd probably need a new option in the compiler config though.
from rescript-relay.
Yeah, this is why we check backend version to prevent stale clients from pinging servers.
from rescript-relay.
Plan on seeing if I can tackle the union part next week. Are you on RescriptRelay v3 already?
from rescript-relay.
Sorry, my notifications on GH are /dev/null
. I'm actually on 1.0.4
at the moment. But TBH I'm thinking of switching to OpenAPI, as the amount of ceremonies when passing sum types through GraphQL is getting off the charts.
from rescript-relay.
Right, got it. We'll let this rest then.
from rescript-relay.
Related Issues (20)
- [RFC] Unions as regular variants
- [RFC] Leverage unboxed variants for representing null values
- [RFC] Remove "top level node field transform"
- Clean up "loadQuery" generation
- @relay(plural: true) prevents @connection helpers from being generated
- [V3] Things to port and fix HOT 5
- %relay ppx: This function is a curried function where an uncurried function is expected HOT 12
- Something went wrong trying to analyze the ReScript project with compiler v11-rc.4 HOT 10
- Blocked rescript@11 migration HOT 11
- Compile error with rescript-reason v2 and ReScript 11 rc.4 HOT 2
- Timestamp type generation support HOT 5
- Add algolia search in docusaurus documentation HOT 1
- Fail to update from 2.1.0 to 2.2.0 HOT 3
- The relay_resolver.error support HOT 3
- @preloadable support HOT 1
- BUG: Failure to resolve useBlockingPaginationFragment (and others) HOT 1
- Plugin for Jetbrains Idea HOT 3
- [3.0] Update Getting Started.
- [3.0] Move to rescript.json HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rescript-relay.