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 a configuration to choose how to encode object-only ADTs #1301

Open
mbaechler opened this issue Feb 11, 2025 · 0 comments
Open

Add a configuration to choose how to encode object-only ADTs #1301

mbaechler opened this issue Feb 11, 2025 · 0 comments

Comments

@mbaechler
Copy link

As you can see here #1300 , ADTs are not encoded the same way in scala 2 and scala 3.

Looking at the scala 2 code, it's just lagging behind in term of feature (it doesn't detect object-only ADTs whereas scala 3 code do).

We could synchronize both versions.

But on some projects, we rely on the scala 2 encoding and we would need to be able to choose this encoding in both scala 2 and scala 3.

By the way, the rational about encoding objects as { "myObject": {} } is : if/when you add a case class to your ADT, you can still parse previous ADT values. If you choose to encode as a simple value, the backward compatibility is much more tricky.

So what about adding a configuration : alwaysEncodeEnumAsObjects?

If you think the feature is a good idea, I can try to propose a PR.

What do you think?

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