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 withRename extract setting #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Equwece
Copy link

@Equwece Equwece commented Jan 3, 2025

Add withRename setting to ReaderBuilder, example:

final case class Foo(foo: String)

inline given JsonReader[Foo] = JsonReader.derived[Foo] {
  ReaderBuilder[Foo]
    .extract(_.foo)
    .withRename("bar")
}

read[Foo](
  obj(
    "bar" -> "test"
  )
) shouldBe Foo("test")

@@ -31,9 +31,11 @@ object ReaderBuilder:
sealed trait AsSyntax[A, B, C]:
def apply(fun: B => C): ReaderBuilder[A]

sealed trait DependentFieldAs[A, B] extends DependentField0[A, B]:
sealed trait DependentFieldExtract[A, B] extends DependentField0[A, B]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

не надо переименовывать - ломается совместимость

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