8000 Implement union types `Gen` instance derivation by guizmaii · Pull Request #9723 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement union types Gen instance derivation #9723

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

Merged
merged 6 commits into from
Mar 28, 2025
Merged

Conversation

guizmaii
Copy link
Member
@guizmaii guizmaii commented Mar 24, 2025

Implementation inspired by Caliban
See:

Usage example:

type StringOrInt = String | Int
given DeriveGen[StringOrInt] = DeriveGen.unionType[StringOrInt]
lazy val anyStringOrInt: Gen[Any, StringOrInt] = DeriveGen[UnionType]

@guizmaii guizmaii self-assigned this Mar 24, 2025
@guizmaii guizmaii changed the title Implement union types Gen instances derivation Implement union types Gen instance derivation Mar 24, 2025
@guizmaii guizmaii marked this pull request as draft March 24, 2025 05:06
@guizmaii guizmaii marked this pull request as ready for review March 24, 2025 05:08
Copy link
Contributor
@kyri-petrou kyri-petrou left a comment

Choose a reason for hiding this comment

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

Awesome work! Just a minor comment

@@ -0,0 +1,65 @@
package zio.test.magnolia
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't read through the code too closely, but do we need this to be in the magnolia package? Afaict we're not using magnolia here (or maybe we are and I missed it, in that case please ignore me)

Copy link
Member Author
@guizmaii guizmaii Mar 24, 2025

Choose a reason for hiding this comment

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

We're not using Magnolia here indeed. Where should I put this?

Did a quick research. DeriveGen is a concept coming from zio-test-magnolia module

Copy link
Member Author
@guizmaii guizmaii Mar 27, 2025

Choose a reason for hiding this comment

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

@kyri-petrou Any chance to get this merged, please? I need it at work

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I'm getting way too many github notifications and I missed this. Merging now :)

@kyri-petrou kyri-petrou merged commit 873668f into series/2.x Mar 28, 2025
18 checks passed
@kyri-petrou kyri-petrou deleted the union_type_gen branch March 28, 2025 05:27
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
0