Skip to content

Conversation

@Malien
Copy link

@Malien Malien commented Nov 30, 2025

I am a man of my word: https://discord.com/channels/625400653321076807/862957601670430731/1438602698575577099

Makes so that @oneOf input 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 a oneOfType: "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

@meta-cla meta-cla bot added the CLA Signed label Nov 30, 2025
@Malien Malien changed the title @oneOf input objects strict typegen @oneOf input objects stricter typegen Nov 30, 2025
# Conflicts:
#	compiler/crates/relay-typegen/src/flow.rs
@Malien
Copy link
Author

Malien commented Dec 1, 2025

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
Copy link
Contributor

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!


impl Default for OneOfGeneration {
fn default() -> Self {
Self::Strict
Copy link
Contributor

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.

@Malien Malien requested a review from captbaritone December 6, 2025 10:52
@Malien
Copy link
Author

Malien commented Dec 6, 2025

@captbaritone I think we're gtg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support @oneOf in generated flow/typescript types

3 participants