Code Monkey home page Code Monkey logo

argonaut's People

Contributors

adelbertc avatar alexarchambault avatar aoiroaoino avatar argonaut-bot[bot] avatar ceedubs avatar coltfred avatar dependabot[bot] avatar github-actions[bot] avatar gitter-badger avatar guymers avatar japgolly avatar jedesah avatar julien-truffaut avatar kevinmeredith avatar lvicentesanchez avatar markhibberd avatar paulbrimicombe avatar rhyskeepence avatar rossabaker avatar runarorama avatar seanparsons avatar sethtisue avatar stephennancekivell avatar stoyle avatar tixxit avatar tonymorris avatar travisbrown avatar travisbrown-stripe avatar vmunier avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

argonaut's Issues

Scalaz 7.1 warnings and errors.

This is just a reminder to follow up on them. Most of them should be fixed in scalaz/scalaz.

  • deprecation warnings when using Scalaz._
  • ambiguous implicits on length

Case codec with optional property

I may miss something, but I can't use Argonaut.casecodecN(...) with case class having an optional (Option[String]) property. Use case is the following one:

case class Owner(name: String, email: Option[String] = None)

implicit def OwnerCodecJson = Argonaut.casecodec2(
    Owner.apply, Owner.unapply)("name", "email")

Failing specs2 test:

  "Owner" should {
    "be decoded without email" in {
      """{"name":"owner"}""".decodeOption[Owner].
        aka("owner") must beSome(Owner("owner"))

    }
  }

If I use code a DecodeJson[Owner] as the following one, test is successful:

  implicit def OwnerDecodeJson: DecodeJson[Owner] = DecodeJson(c  for {
    name  (c --\ "name").as[String]
    email  (c --\ "email").as[String].option
  } yield Owner(name, email))

ScalaCheck properties fail to compile on 2.10

See: https://travis-ci.org/markhibberd/argonaut/jobs/3745016

140[info] Compiling 9 Scala sources to /home/travis/builds/markhibberd/argonaut/target/scala-2.10/test-classes...
141[error] /home/travis/builds/markhibberd/argonaut/src/test/scala/argonaut/JsonTest.scala:30: could not find implicit value for parameter a2: org.scalacheck.Arbitrary[argonaut.Json.JsonArray => argonaut.Json.JsonArray]
142[error] forAll((j: Json, k: JsonArray => JsonArray) =>
143[error] ^
144[error] /home/travis/builds/markhibberd/argonaut/src/test/scala/argonaut/JsonTest.scala:54: could not find implicit value for parameter a1: org.scalacheck.Arbitrary[argonaut.Json.JsonArray]
145[error] forAll((a: JsonArray) =>
146[error] ^
147[error] two errors found
148error Compilation failed
149[error] Total time: 65 s, completed Dec 19, 2012 7:04:46 PM

Stream-based reading and writing

As far as I can tell (and I might very well be wrong), argonaut currently only knows how to read from / write to strings.

This seems like a suboptimal solution for cases where, for example, one wants to read a tiny JSON object from a file that happens to contains gigabytes of whitespace padding.

It seems that, at least for the input part, solving this could be as simple as having the Parser work with instances of Iterator[Char] or Iterable[Char]: both String and Source are collections of characters and can be transformed into an iterator on characters fairly easily.

Or is this possibly because having a string, and thus knowing the amount of data to parse, allows for drastic parsing optimisations?

JsonGenerators sometimes generates an empty string instead of valid Json

@seanparsons How much value do you think there is in generating the json as a string? Could we switch test around a bit so that we just used an arbitrary for the Json datatype, then tested:
print -> parse -> print a different way -> parse

I think this would make the test a fair bit more robust. If required we could add back some of the known answer tests containing specific json strings to cover off unusually formatted json.

Stable scalaz 7.1.x and specs2.

This is breaking the tests at the moment unless you locally coerce the dependencies with magical chicken incantations to get matching versions.

Consing pairs together to form an object results in non-obvious ordering.

For example:

import argonaut._
import Argonaut._
json: argonaut.Json = {"blue":false,"red":true}

scala> val json = ("red" := true) ->: ("blue" := false) ->: jEmptyObject
json: argonaut.Json = {"blue":false,"red":true}

This is not a bug in the implementation per se, it is purely insertion order as expected. But it highlights a short coming in using "insertion" ordering. I think there is a case for for changing the semantics of ->: to have the expected behaviour.

This inconsistency is most likely a result of ->: being implemented on the old JObject impl when it was an association list and not being re-thought when we swapped to InsertionMap.

jdecode2l bomb. Initialization of val on HCursor?

[error] NullPointerException: null (HCursor.scala:304)
[error] argonaut.HCursor$class.jdecode(HCursor.scala:18)
[error] argonaut.HCursor$$anon$1.jdecode(HCursor.scala:304)
[error] argonaut.DecodeJsons$$anonfun$jdecode2L$1.apply(DecodeJson.scala:325)
[error] argonaut.DecodeJsons$$anonfun$jdecode2L$1.apply(DecodeJson.scala:324)
[error] argonaut.DecodeJson$$anon$1.apply(DecodeJson.scala:88)
[error] argonaut.Json$class.jdecode(Json.scala:397)
[error] argonaut.JObject.jdecode(Json.scala:461)
[error] argonaut.Parse$$anonfun$decode$2.apply(Parse.scala:48)
[error] argonaut.Parse$$anonfun$decode$2.apply(Parse.scala:47)
[error] argonaut.Parse$class.decode(Parse.scala:47)
[error] argonaut.Parse$.decode(Parse.scala:99)
[error] argonaut.Parse$class.decodeWithEither(Parse.scala:68)
[error] argonaut.Parse$.decodeWithEither(Parse.scala:99)
[error] argonaut.Parse$class.decodeWith(Parse.scala:59)
[error] argonaut.Parse$.decodeWith(Parse.scala:99)
[error] argonaut.Parse$class.decodeWithMessage(Parse.scala:77)
[error] argonaut.Parse$.decodeWithMessage(Parse.scala:99)
[error] argonaut.ParseWrap.decodeWithMessage(ParseWrap.scala:78)

Argonaut decoder with ObjectId

Hi, I need to decode case classes with ObjectId because I'm using MongoDB. But when I try to decode a case class with one or more ObjectId I get the following errors:

could not find implicit value for evidence parameter of type argonaut.EncodeJson[org.bson.types.ObjectId]
implicit def SensorCodecJson = casecodec6(Sensor.apply, Sensor.unapply)("id", "service", "driver", "mac", "version", "protocol")

not enough arguments for method casecodec6: (implicit evidence$537: argonaut.EncodeJson[org.bson.types.ObjectId], implicit evidence$538: argonaut.DecodeJson[org.bson.types.ObjectId], implicit evidence$539: argonaut.EncodeJson[org.bson.types.ObjectId], implicit evidence$540: argonaut.DecodeJson[org.bson.types.ObjectId], implicit evidence$541: argonaut.EncodeJson[org.bson.types.ObjectId], implicit evidence$542: argonaut.DecodeJson[org.bson.types.ObjectId], implicit evidence$543: argonaut.EncodeJson[String], implicit evidence$544: argonaut.DecodeJson[String], implicit evidence$545: argonaut.EncodeJson[String], implicit evidence$546: argonaut.DecodeJson[String], implicit evidence$547: argonaut.EncodeJson[Int], implicit evidence$548: argonaut.DecodeJson[Int])argonaut.CodecJson[models.Sensor].
Unspecified value parameters evidence$537, evidence$538, evidence$539, ...
implicit def SensorCodecJson = casecodec6(Sensor.apply, Sensor.unapply)("id", "service", "driver", "mac", "version", "protocol")

My workaround is to create another case class with strings to decode it and then convert to ObjectId

Convert String to Json

I have val str: String = "{\"metafield\":{\"requiredArray\":[1,2,3],\"someBool\":true,\"someNull\":null}}"
I need to get requiredArray. In IRC someone recommended cursor.downField("metafield"). The week has passed, but nobody could tell me how to convert str: String to Json from which I could get cursor.

How it could be done?

Remove scala.Either

There are uses of scala.Either around the code. Remove all in favour of the usual improvement: scalaz./

Could do with a jNumberDPL lens.

We have a jNumberPL lens, but it would be very convenient if there was a lens that for a number would get you directly to the Double value.

Potential deadlock in tests from JsonObject.

Tests locking up.

Output from YourKit:

Frozen threads found (potential deadlock)

It seems that the following threads have not changed their stack for more than 10 seconds.
These threads are possibly (but not necessarily!) in a deadlock or hung.


Thread-5 <--- Frozen for at least 17s
argonaut.JsonObject$.<init>()
argonaut.JsonObject$.<clinit>()
argonaut.Data$$anonfun$jsonObjectGenerator$3.apply(Map)
argonaut.Data$$anonfun$jsonObjectGenerator$3.apply(Object)
scala.Option.map(Function1)
org.scalacheck.Gen$$anonfun$map$1.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$map$1.apply(Object)
org.scalacheck.Gen$$anon$3.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$map$1.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$map$1.apply(Object)
org.scalacheck.Gen$$anon$3.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$flatMap$1$$anonfun$apply$21.apply(Object)<2 recursive calls>
scala.Option.flatMap(Function1)
org.scalacheck.Gen$$anonfun$flatMap$1.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$flatMap$1.apply(Object)
org.scalacheck.Gen$$anon$3.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$sequence$1.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$sequence$1.apply(Object)
org.scalacheck.Gen$$anon$3.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$map$1.apply(Gen$Params)
org.scalacheck.Gen$$anonfun$map$1.apply(Object)
org.scalacheck.Gen$$anon$3.apply(Gen$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Object)
org.scalacheck.Prop$$anon$1.apply(Prop$Params)
org.scalacheck.Test$$anonfun$worker$1$1$$anonfun$apply$2.apply()<2 recursive calls>
org.scalacheck.Test$.org$scalacheck$Test$$secure(Function0)
org.scalacheck.Test$$anonfun$worker$1$1.apply()<2 recursive calls>
scala.actors.Futures$$anonfun$1.apply(SyncVar)
scala.actors.Futures$$anonfun$1.apply(Object)
scala.actors.FutureActor$$anonfun$act$1.apply()<2 recursive calls>
scala.actors.Reactor$class.seq(Reactor, Function0, Function0)
scala.actors.FutureActor.seq(Function0, Function0)
scala.actors.Reactor$$anon$3.andThen(Function0)
scala.actors.FutureActor.act()
scala.actors.Reactor$$anonfun$dostart$1.apply()<2 recursive calls>
scala.actors.ReactorTask.run()
scala.actors.threadpool.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)
scala.actors.threadpool.ThreadPoolExecutor$Worker.run()
java.lang.Thread.run()



Thread-6 <--- Frozen for at least 17s
argonaut.Json$class.withString(Json, Function1)
argonaut.JString.withString(Function1)
argonaut.JsonSpecification$$anonfun$is$1$$anonfun$apply$5$$anonfun$appl$$$$b9c9413f9b2ac4c037ddf838c4be2a61$$$$apply$19$$anonfun$apply$20$$anonfun$apply$21$$anonfun$apply$22$$anonfun$apply$23$$anonfun$apply$28$$anonfun$apply$29.apply(JString)
argonaut.JsonSpecification$$anonfun$is$1$$anonfun$apply$5$$anonfun$appl$$$$b9c9413f9b2ac4c037ddf838c4be2a61$$$$apply$19$$anonfun$apply$20$$anonfun$apply$21$$anonfun$apply$22$$anonfun$apply$23$$anonfun$apply$28$$anonfun$apply$29.apply(Object)
org.specs2.matcher.ScalaCheckMatchers$$anonfun$check1$1$$anonfun$apply$1.apply()
scala.Function0$class.apply$mcZ$sp(Function0)
scala.runtime.AbstractFunction0.apply$mcZ$sp()
org.specs2.matcher.ResultPropertyImplicits$$anonfun$booleanToProp$1.apply()<2 recursive calls>
org.specs2.execute.ResultExecution$class.execute(ResultExecution, Function0)
org.specs2.execute.ResultExecution$.execute(Function0)
org.specs2.matcher.ResultPropertyImplicits$$anon$6.result$17(ObjectRef, VolatileIntRef)
org.specs2.matcher.ResultPropertyImplicits$$anon$6.apply(Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1$$anonfun$3.apply(Object)<2 recursive calls>
scala.collection.immutable.Stream.map(Function1, CanBuildFrom)
org.scalacheck.Prop$$anonfun$forAllShrink$1.getFirstFailure$1(Stream, Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Object)
org.scalacheck.Prop$$anon$1.apply(Prop$Params)
org.scalacheck.Test$$anonfun$worker$1$1$$anonfun$apply$2.apply()<2 recursive calls>
org.scalacheck.Test$.org$scalacheck$Test$$secure(Function0)
org.scalacheck.Test$$anonfun$worker$1$1.apply()<2 recursive calls>
scala.actors.Futures$$anonfun$1.apply(SyncVar)
scala.actors.Futures$$anonfun$1.apply(Object)
scala.actors.FutureActor$$anonfun$act$1.apply()<2 recursive calls>
scala.actors.Reactor$class.seq(Reactor, Function0, Function0)
scala.actors.FutureActor.seq(Function0, Function0)
scala.actors.Reactor$$anon$3.andThen(Function0)
scala.actors.FutureActor.act()
scala.actors.Reactor$$anonfun$dostart$1.apply()<2 recursive calls>
scala.actors.ReactorTask.run()
scala.actors.threadpool.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)
scala.actors.threadpool.ThreadPoolExecutor$Worker.run()
java.lang.Thread.run()



Thread-7 <--- Frozen for at least 17s
argonaut.Jsons$class.$init$(Jsons)
argonaut.Json$.<init>()
argonaut.Json$.<clinit>()
argonaut.JsonSpecification$$anonfun$is$1$$anonfun$apply$5$$anonfun$appl$$$$b9c9413f9b2ac4c037ddf838c4be2a61$$$$apply$19$$anonfun$apply$20$$anonfun$apply$21$$anonfun$apply$22$$anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply$26.apply(Json)
argonaut.JsonSpecification$$anonfun$is$1$$anonfun$apply$5$$anonfun$appl$$$$b9c9413f9b2ac4c037ddf838c4be2a61$$$$apply$19$$anonfun$apply$20$$anonfun$apply$21$$anonfun$apply$22$$anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply$26.apply(Object)
org.specs2.matcher.ScalaCheckMatchers$$anonfun$check1$1$$anonfun$apply$1.apply()
scala.Function0$class.apply$mcZ$sp(Function0)
scala.runtime.AbstractFunction0.apply$mcZ$sp()
org.specs2.matcher.ResultPropertyImplicits$$anonfun$booleanToProp$1.apply()<2 recursive calls>
org.specs2.execute.ResultExecution$class.execute(ResultExecution, Function0)
org.specs2.execute.ResultExecution$.execute(Function0)
org.specs2.matcher.ResultPropertyImplicits$$anon$6.result$17(ObjectRef, VolatileIntRef)
org.specs2.matcher.ResultPropertyImplicits$$anon$6.apply(Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1$$anonfun$3.apply(Object)<2 recursive calls>
scala.collection.immutable.Stream.map(Function1, CanBuildFrom)
org.scalacheck.Prop$$anonfun$forAllShrink$1.getFirstFailure$1(Stream, Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Object)
org.scalacheck.Prop$$anon$1.apply(Prop$Params)
org.scalacheck.Test$$anonfun$worker$1$1$$anonfun$apply$2.apply()<2 recursive calls>
org.scalacheck.Test$.org$scalacheck$Test$$secure(Function0)
org.scalacheck.Test$$anonfun$worker$1$1.apply()<2 recursive calls>
scala.actors.Futures$$anonfun$1.apply(SyncVar)
scala.actors.Futures$$anonfun$1.apply(Object)
scala.actors.FutureActor$$anonfun$act$1.apply()<2 recursive calls>
scala.actors.Reactor$class.seq(Reactor, Function0, Function0)
scala.actors.FutureActor.seq(Function0, Function0)
scala.actors.Reactor$$anon$3.andThen(Function0)
scala.actors.FutureActor.act()
scala.actors.Reactor$$anonfun$dostart$1.apply()<2 recursive calls>
scala.actors.ReactorTask.run()
scala.actors.threadpool.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)
scala.actors.threadpool.ThreadPoolExecutor$Worker.run()
java.lang.Thread.run()



Thread-8 <--- Frozen for at least 17s
argonaut.Json$class.withNumber(Json, Function1)
argonaut.JNumber.withNumber(Function1)
argonaut.JsonSpecification$$anonfun$is$1$$anonfun$apply$5$$anonfun$appl$$$$b9c9413f9b2ac4c037ddf838c4be2a61$$$$apply$19$$anonfun$apply$20$$anonfun$apply$21$$anonfun$apply$22$$anonfun$apply$32$$anonfun$apply$33.apply(JNumber)
argonaut.JsonSpecification$$anonfun$is$1$$anonfun$apply$5$$anonfun$appl$$$$b9c9413f9b2ac4c037ddf838c4be2a61$$$$apply$19$$anonfun$apply$20$$anonfun$apply$21$$anonfun$apply$22$$anonfun$apply$32$$anonfun$apply$33.apply(Object)
org.specs2.matcher.ScalaCheckMatchers$$anonfun$check1$1$$anonfun$apply$1.apply()
scala.Function0$class.apply$mcZ$sp(Function0)
scala.runtime.AbstractFunction0.apply$mcZ$sp()
org.specs2.matcher.ResultPropertyImplicits$$anonfun$booleanToProp$1.apply()<2 recursive calls>
org.specs2.execute.ResultExecution$class.execute(ResultExecution, Function0)
org.specs2.execute.ResultExecution$.execute(Function0)
org.specs2.matcher.ResultPropertyImplicits$$anon$6.result$17(ObjectRef, VolatileIntRef)
org.specs2.matcher.ResultPropertyImplicits$$anon$6.apply(Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1$$anonfun$3.apply(Object)<2 recursive calls>
scala.collection.immutable.Stream.map(Function1, CanBuildFrom)
org.scalacheck.Prop$$anonfun$forAllShrink$1.getFirstFailure$1(Stream, Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Prop$Params)
org.scalacheck.Prop$$anonfun$forAllShrink$1.apply(Object)
org.scalacheck.Prop$$anon$1.apply(Prop$Params)
org.scalacheck.Test$$anonfun$worker$1$1$$anonfun$apply$2.apply()<2 recursive calls>
org.scalacheck.Test$.org$scalacheck$Test$$secure(Function0)
org.scalacheck.Test$$anonfun$worker$1$1.apply()<2 recursive calls>
scala.actors.Futures$$anonfun$1.apply(SyncVar)
scala.actors.Futures$$anonfun$1.apply(Object)
scala.actors.FutureActor$$anonfun$act$1.apply()<2 recursive calls>
scala.actors.Reactor$class.seq(Reactor, Function0, Function0)
scala.actors.FutureActor.seq(Function0, Function0)
scala.actors.Reactor$$anon$3.andThen(Function0)
scala.actors.FutureActor.act()
scala.actors.Reactor$$anonfun$dostart$1.apply()<2 recursive calls>
scala.actors.ReactorTask.run()
scala.actors.threadpool.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)
scala.actors.threadpool.ThreadPoolExecutor$Worker.run()
java.lang.Thread.run()

Documentation.

Some nice looking (and complete) docs for 6.0 release would be nice. I will grab a domain to host it on in the near future.

README.md also needs an update with info on latest parser.

Would be nice to publish some ongoing release notes for any changes that break compatibility (for example #1) and also some performance numbers now that the parse is not ridiculously slow anymore (Something like Data.Aeson provides).

Clean-up StringWrap

There is too much implementation tied to the implicit on String. Would prefer a complete stand-alone API, maybe an argonaut.Parse object or similar. Then just promote the most useful operations to StringWrap.

argonaut 6.0-RC1

Would like to do this next week (that is week starting 29th of April).

Before though, need to do:

  • Finish codec-json branch and #18
  • Fix #27 (probably convert to case class).
  • Doc review and polish.

@seanparsons How does this sit with you? Did you want to get #37 in as well?

String names in codecs

The String name in EncodeJson and DecodeResult are an extremely bad idea. They need to disappear.

Issues with implicit search.

Since last milestone release, the implicit search seems to breaking. Sometimes implicits in companion object are not picked up. See Tweet example as replication case.

Yourkit licences

@markhibberd @tonymorris Yourkit are happy to supply us with an open source licence, with a proviso that we add something akin to the stock "Yourkit are really nice." text somewhere on the site. Is everyone happy with me giving them names and adding that to the site? If happy for others, but don't want the licence, please also say so.

nested case classes capability

I am new to scala and first look at anything in scalaz so my apologies as this is a newbie question rather than an actual issue. I have the v6.0 code checked out and have cloned the json example and am trying to use my own nested case classes:

package argonaut.example

import argonaut._, Argonaut._
import org.specs2._

abstract class Message
case class CardDrawn(player: Long, card: Int, mType: String = "CardDrawn") extends Message
case class CardSet(cards: List[CardDrawn], mType: String = "CardSet") extends Message

object CardSetExample extends Specification {
  val json =
    Json(
      "mType" := "CardSet",
      "cards" := List(
        Json ( "mType" := "CardDrawn", "player" := 1L, "card" :=2 ),
        Json ( "mType" := "CardDrawn", "player" := 1L, "card" :=2 ),
        Json ( "mType" := "CardDrawn", "player" := 1L, "card" :=2 )
      )
    )

  val value = CardSet(List(CardDrawn(1L,2),CardDrawn(3L,4)))

  implicit val CodecCardSet = casecodec2(CardSet.apply, CardSet.unapply)("mType","cards")
  implicit val CodecCardDrawn = casecodec3(CardDrawn.apply, CardDrawn.unapply)("mType", "player", "card")

  def is = "JsonExample" ^
    "Can decode hand crafted object" ! {
      json.as[CardSet].toOption must beSome(value)
    } ^
    "Can encode to match hand crafted object" ! {
      value.asJson must_== json
    }
}

This does not work however running it on the sbt console it barfs out

> test-only argonaut.example.CardSetExample
[info] Compiling 1 Scala source to /Users/simbo/git/argonaut-60/target/scala-2.10/test-classes...
[error] /Users/simbo/git/argonaut-60/src/test/scala/argonaut/example/CardSetExample.scala:25: could not find implicit value for evidence parameter of type argonaut.EncodeJson[List[argonaut.example.CardDrawn]]
[error]   implicit val CodecCardSet = casecodec2(CardSet.apply, CardSet.unapply)("mType","cards")
[error]                                                                         ^
[error] /Users/simbo/git/argonaut-60/src/test/scala/argonaut/example/CardSetExample.scala:30: could not find implicit value for parameter e: argonaut.DecodeJson[argonaut.example.CardSet]
[error]       json.as[CardSet].toOption must beSome(value)
[error]              ^
[error] two errors found
[error] (argonaut/test:compile) Compilation failed
[error] Total time: 5 s, completed 04-Sep-2013 22:05:49
> 

Which clearly states that I don't know what I need to do to make a codec which handles the round trip. Is this supported?

Thanks for your consideration in this matter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.