Skip to content

Conversation

@ericszentivanyi
Copy link
Contributor

@ericszentivanyi ericszentivanyi commented Jan 1, 2026

This PR introduces an or-pattern syntax, allowing the same patch to be applied to multiple generated types.

Example

import_types!(
  schema = "../schema.json",
  patches = {
    Foo | Bar = {
      derives = [/* ... */],
    },
  },
);

Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this work if rename is specified?

@ericszentivanyi
Copy link
Contributor Author

ericszentivanyi commented Jan 8, 2026

How would this work if rename is specified?

Good question. This would require a simple restriction preventing patches that use the or-pattern from specifying renames when applied to multiple types. I used PatchType as the foundation for implementing variant patches (via a PatchType::Path variant), so rename is still supported for variants, but not when applied to types.

Similarly, variant patches should not be able to specify derives, so I added a restriction for that as well. Let me know if you would like me to implement something similar.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants