by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 24 09:59
    travisbrown closed #1533
  • Sep 24 09:57
    travisbrown closed #1535
  • Sep 24 09:56

    travisbrown on master

    Update refined, refined-scalach… (compare)

  • Sep 24 09:56
    travisbrown closed #1539
  • Sep 21 14:33
    neko-kai opened #1540
  • Sep 20 10:33
    codecov-commenter commented #1539
  • Sep 20 10:30
    codecov-commenter commented #1539
  • Sep 20 10:18
    scala-steward review_requested #1539
  • Sep 20 10:18
    scala-steward opened #1539
  • Sep 18 16:34
    scala-steward opened #1538
  • Sep 18 16:34
    scala-steward review_requested #1538
  • Sep 16 21:28
    benhutchison commented #877
  • Sep 16 20:50
    okouyad commented #877
  • Sep 16 17:46
    eggsby commented #1267
  • Sep 16 17:45
    eggsby commented #1267
  • Sep 16 17:22
    Lasering commented #1537
  • Sep 16 15:16
    travisbrown commented #1537
  • Sep 16 13:58
    Lasering commented #1537
  • Sep 16 12:22
    Lasering commented #1537
  • Sep 16 12:22
    Lasering synchronize #1537
ybasket
@ybasket
@zeshansali circe doesn’t come with an Encoder for java.util.Date, so define your own or use java.time.LocalDate
ComFreek
@ComFreek
I am running into a stack overflow with the Scala compiler when compiling some code with nested case classes and io.circe.generic.auto._.
I tried increasing the stack size -- as mentioned in the docs: https://circe.github.io/circe/codecs/known-issues.html -- to no avail.
To be precise, I tried increasing it in IntelliJ's settings pane (the IntelliJ project is imported from an SBT build file). I am not entirely sure that IntelliJ picks that up.
ComFreek
@ComFreek
I now tried the native SBT shell. Same error: https://pastebin.com/frNLSVhj
I had set the stack size via javaOptions in Global ++= Seq("-Xmx2g", "-Xss512m") in my build.sbt.
ComFreek
@ComFreek
Is there any way to circumvent the problem?
I have now tried to provide explicit implicits implicit val enc = Encoder[MyCaseClass], implicit val dec = Encoder[MyCaseClass]. It works in IntelliJ (only by coincidence?), but not from the SBT shell.
Zeshan Ali
@zeshansali
@ybasket That worked - thanks for the help.
Felix Palludan Hargreaves
@hejfelix
Can I compose multiple Plated transformations such that I don't have to traverse the structure multiple times?
Alex Antonov
@antonoal
Hi. I've just updated the libs versions on my project and got java.lang.NoSuchMethodError: fs2.Pull$.stream$extension(Lfs2/internal/FreeC;)Lfs2/internal/FreeC;. I believe it's cause by the fact that circe-fs2 v 0.13 is built against fs2 v2.2.2. Is there a release planned built for fs2 v 2.4.x any time soon or should I hold on with the upgrade?
Gavin Bisesi
@Daenyth
Sounds more like an error in fs2 that 2.4 breaks bincompat with 2.2
:eyes: yes fs2 2.4 says it's binary compatible with previous 2.x releases
Damian van Beekum
@theejazz
Hi! I've been having trouble trying out automated decoding. I keep getting a DecodingFailure, specifically "Attempt to decode value on failed cursor, List(DownField(hits))" where 'hits' is a key in my JSON. Interestingly, the key it prints often appears to be the very last item in my JSON (It's not always, but that might be a caching issue). Any suggestions as to how I might fix this? Below is a simple example that produces this result for me:
import io.circe.generic.auto._
import io.circe.parser.decode

case class Request(meta: Meta, response: Response)
case class Meta(status: Int, message: Option[String])
case class Response(hits: String)

object RequestDecoder {
  def main(args: Array[String]): Unit = {
    val request = """{"meta":{"status":200},"response":{"hits":"hi"}}"""
    println(decode[Response](request))
  }
}
Yilin Wei
@yilinwei
@theejazz I'm on a phone so the formatting may be off, but isn't that a Request rather than a Response?
Alex Antonov
@antonoal
I'll raise it with fs2, thanks @Daenyth
Alex Antonov
@antonoal
Actually it's my mistake - no issue with fs2
Damian van Beekum
@theejazz
@yilinwei wow I'm genuinely facepalming right now... Thanks!
Ashwin Bhaskar
@ashwinbhaskar

I start getting this error after adding http4s-circe dependency.

 The json interpolator requires jawn to be available at compile time
[error]         val expectedJson = json"""

Why does this happen and how can i resolve it?

Gavin Bisesi
@Daenyth
Add jawn at % Compile scope
Tharun Kumar Kapse
@tkapse
Hi All, I am trying to decode JsonArray with ~900 objects where it complains with malformed json error. When I reduce the json count to ~110 objects it works properly. I am trying to understand is there any limit on no. of object in an array or is it the data size that's causing this issue?
cld u please help me out
Ashwin Bhaskar
@ashwinbhaskar
@Daenyth but it worked before I introduced http-circedependency.
Gavin Bisesi
@Daenyth
weird. I don't know
Damian van Beekum
@theejazz
Does Circe have a way of unifying the two statements below to remove path duplication? (custom decoding)
id <- c.downField("result").downField("group").downField("id").as[Int]
name <- c.downField("result").downField("group").downField("name").as[String]
Gavin Bisesi
@Daenyth
group = c.downField("result").downField("group")
id <- group.downField("id").as[Int]
name <- group.downField("name").as[String]
?
or maybe consider using the JsonPath optics, they're pretty sweet for code readability if not necessarily as great for error messages
Travis Brown
@travisbrown
@tkapse there are no size limits (unless you explicitly opt in to limited number sizes for safety reasons). If you run the same object through a JSON linter or something like jq there are no errors?
@ashwinbhaskar that sounds likely to be a version mismatch (http4s bringing in a newer or older version of jawn than one you’re getting from e.g. circe-parser).
2 replies
Damian van Beekum
@theejazz
@Daenyth Thanks! Tried that initially but turns out I had some scope problems. Will definitely look into JsonPath
Tharun Kumar Kapse
@tkapse
@travisbrown - when I trim the json and post with size 64KB its able to decode.. If i add one more object to json array it starts complaining with invalid json
the entire json size is around 500KB
Travis Brown
@travisbrown
@tkapse but do other JSON parsers handle the full version? just to eliminate the possibility of unrelated malformedness.
@tkapse also IIRC there are various JVM restrictions on strings at 64K
If you have a minimisation I'd be happy to take a look
Tharun Kumar Kapse
@tkapse
@travisbrown I tried one of online json validators and it was able to parse it..
Travis Brown
@travisbrown
:thumbsup:
Tharun Kumar Kapse
@tkapse
{
"first_name": "tharun",
"last_name": "kapse",
"gender": "male",
"address": {
"flat_no": "XXXX",
"street": "XXXX",
"address_line1": "XXXX",
"address_line2": "XXXX",
"city": "XXXX",
"Landmarks": [
],
"others": {},
"city": "XXXX",
"State": "XXXX"
},
"email": "XXXX"
}
each object would look something like this
in the array
Jente Hidskes
@Hjdskes
Given a Decoder, is it possible to retrieve the discriminator used in this decoder, if any?
Travis Brown
@travisbrown
@Hjdskes you could have a subtype of Decoder that carries around extra structure / info like that, but it's not currently provided.
Jente Hidskes
@Hjdskes
@travisbrown Thanks :)
Michael Sluyter
@msluyter
Hi. Pretty much of a newbie question. I was just attempting the Quick Start section of the docs and get the following:
[info] Starting scala interpreter...
Welcome to Scala 2.13.3 (Java HotSpot(TM) 64-Bit Server VM, Java 11.0.7).
Type in expressions for evaluation. Or try :help.

scala> import io.circe._, io.circe.generic.auto._, io.circe.parser._, io.circe.syntax._
     |
import io.circe._
import io.circe.generic.auto._
import io.circe.parser._
import io.circe.syntax._

scala> sealed trait Foo
     |
trait Foo

scala> case class Bar(xs: Vector[String]) extends Foo
     |
class Bar

scala> case class Qux(i: Int, d: Option[Double]) extends Foo
     |
class Qux

scala> val foo: Foo = Qux(13, Some(14.0))
     |
val foo: Foo = Qux(13,Some(14.0))

scala> val json = foo.asJson.noSpaces
     |
                      ^
       error: Internal error: unable to find the outer accessor symbol of class

basically just cut & pasted the code from the example. I did add

scalacOptions ++= Seq("-Ymacro-annotations")

to my build.sbt

Anyone seen this before and/or have any ideas?
Travis Brown
@travisbrown
@msluyter ugh, I hadn't seen that particular one before, but the 2.13 patch releases have broken a ton of stuff in the REPL in general…
this one looks like it broke in 2.13.2.
it should be fine if you use :paste mode for the sealed trait and case classes
(i.e. enter :paste, copy and paste those lines, and then ctrl-D)
Michael Sluyter
@msluyter
using :paste worked, thanks @travisbrown!