Skip to content
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

Add an option to generate oneof fields as a sealed abstract class #1694

Open
joroKr21 opened this issue May 19, 2024 · 0 comments
Open

Add an option to generate oneof fields as a sealed abstract class #1694

joroKr21 opened this issue May 19, 2024 · 0 comments

Comments

@joroKr21
Copy link

Currently oneof fields are generated as sealed traits with every variant resulting in two methods to the trait:

  • isFoo: Boolean
  • foo: Option[Foo]

Because it's a trait, the methods are mixed in to the $n$ subclasses (variants).
So in total, there are $2n^2$ methods generated.

In contrast, Abstract class methods are not mixed in.
So for oneof fields with many variants, it would be beneficial to generate an abstract class.

@joroKr21 joroKr21 changed the title Add an option to generate oneof fields as an abstract class Add an option to generate oneof fields as a sealed abstract class May 19, 2024
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

No branches or pull requests

1 participant