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

JsonCodec fails to decode pretty printed case class with Option[Int/Long] when it is last field #675

Closed
russwyte opened this issue Apr 10, 2024 · 2 comments

Comments

@russwyte
Copy link
Contributor

Given a case class like:

  final case class WithOptionFields(a: Option[String], b: Option[Int])

  object WithOptionFields {
    implicit lazy val schema: Schema[WithOptionFields] = DeriveSchema.gen[WithOptionFields]
  }

the following test should pass:

      test("case class with option fields present from pretty printed json") {
        assertDecodes(
          WithOptionFields.schema,
          WithOptionFields(Some("s"), Some(1)),
          charSequenceToByteChunk(
            """
              |{
              |  "a": "s",
              |  "b": 1
              |}
              |""".stripMargin
          )
        )
      }

image
But that test fails
image

@russwyte
Copy link
Contributor Author

Interestingly - if you change the order of the fields in the json string the test passes.

image

@russwyte
Copy link
Contributor Author

@987Nabil It looks like the latest release did not get correctly published - is CI broken?

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