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

json 26 fields limitation #1014

Open
shmishleniy opened this issue Sep 7, 2023 · 1 comment
Open

json 26 fields limitation #1014

shmishleniy opened this issue Sep 7, 2023 · 1 comment

Comments

@shmishleniy
Copy link

Hi, is there a workaround to generate an encoder/decoder for a case class with more than 26 fields?

Here is the error for the case class with 26 optional fields:
DeriveJsonDecoder[Qwe] [error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [error] | Maximal number of successive inlines (32) exceeded, [error] | Maybe this is caused by a recursive inline method? [error] | You can use -Xmax-inlines to change the limit.

tried setting -Xmax-inlines, but then it became a problem at the decoding stage in runtime because of this require

require(xs.length + aliases.length < 64)

Current 26 field limit makes it impossible to use with many data providers and forces to include an additional json library. Moreover that's limiting zio ecosystem for example quill jsonb processing

@plokhotnyuk
Copy link
Contributor

@shmishleniy As a workaround you can derive zio-json codecs that supports 64+ cases of ADTs and 64+ fields of case classes using zio-schema-json's schemas: https://github.com/zio/zio-schema/blob/57b20592e5d494a8a111d8423fde7684918c9d29/zio-schema-json/shared/src/test/scala/zio/schema/codec/JsonCodecSpec.scala#L2943-L3092

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

2 participants