-
Notifications
You must be signed in to change notification settings - Fork 1.9k
@oneOf input objects stricter typegen #5108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # compiler/crates/relay-typegen/src/flow.rs
|
I might want to run the whole rustfmt / fixture-gen to fix the formatting checks |
| ), | ||
| }) | ||
| }) | ||
| let node = if typegen_context.project_config.typegen_config.one_of_type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this a config option!
compiler/crates/relay-typegen/tests/generate_flow_with_custom_id_test.rs
Outdated
Show resolved
Hide resolved
|
|
||
| impl Default for OneOfGeneration { | ||
| fn default() -> Self { | ||
| Self::Strict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this default choice.
|
@captbaritone I think we're gtg |
I am a man of my word: https://discord.com/channels/625400653321076807/862957601670430731/1438602698575577099
Makes so that
@oneOfinput types generate a more strict type union, that permits only a single property being set a a time. This is technically a breaking change, since people may have relied on a more permissive type in their application logic. So there is an escape hatch of aoneOfType: "relaxed". I'm not sure this is a necessary option to have. We might as well break a tiny (like real tiny) amount of people's types.Closes #5095