Created
November 25, 2014 14:04
-
-
Save propensive/7756a19358b51774d215 to your computer and use it in GitHub Desktop.
Better compile-time diagnostics when attempting to extract case classes from JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> case class Bar(file: java.io.File) // We can't extract a File | |
defined class Bar | |
scala> case class Foo(bar: Bar) // therefore we can't extract a Bar | |
defined class Foo | |
scala> json""{ "bar": { "file": "..." } }""".as[Foo] | |
Could not generate a Json extractor for case class Bar because a Json extractor for parameter `file' of type java.io.File could not be found | |
Could not generate a Json extractor for case class Foo because a Json extractor for parameter `bar' of type Bar could not be found | |
<console>:21: error: cannot extract type Foo from rapture.json.Json. | |
json"""{ "bar": { "file": "..." } }""".as[Foo] | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment