Nested case classes with Option types wrapped in List fails to materialize pickler
See original GitHub issueWith the API pasted below, I get the error in my client when I swap in the actual CommandMetaData case class (currently commented out):
Cannot materialize pickler for non-case class: List[model.Command]. If this is a collection, the error can refer to the class inside.
[error] AutowireClient[Api].exec(cmds).call().toRx.map {
[error] ^
[error] one error found
The API:
package model
import java.net.InetAddress
import java.util.UUID
import scala.concurrent.Future
trait Api {
//def exec(data: List[Command])(implicit serverMeta: ImplicitMetaData): Future[String]
def exec(data: List[Command]): Future[String]
def poll(id: CommandId): Future[String]
}
case class CommandId(id: UUID)
object CommandId {
def apply() = new CommandId(UUID.randomUUID)
}
//case class CommandMetaData(
// shell: Option[String] = None,
// containerId: Option[String] = None,
// image: Option[String] = None,
// user: Option[String] = None,
// address: Option[InetAddress] = None,
//)
case class CommandMetaData()
case class ImplicitMetaData(meta: Option[CommandMetaData])
case class Command(id: CommandId, body: String, meta: CommandMetaData)
case class RunResult(out: String, err: String, exitCode: Int)
case class CommandWithResult(command: Command, result: RunResult)
And here is the wrapper function for hte exec call that failed:
def exec(cmds: List[Command]): Rx[String] = {
println("Verifying outer exec is called")
AutowireClient[Api].exec(cmds).call().toRx.map { // This line fails
case Some(attempt) => attempt match {
case Success(output) => output
case Failure(err) => s"Error: ${err.getCause}!"
}
case None => ""
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Nested case classes with Option types wrapped in List fails to ...
Nested case classes with Option types wrapped in List fails to materialize pickler. With the API pasted below, I get the error in...
Read more >A Combination of Lists, Case Classes and Tuples does not ...
A simple combination of Lists, Cases Classes and Tuples does not compile. I see no reason, why it shouldn't work. I minimized the...
Read more >Error updating with nested case classes in Scala Mongo DB
So I deleted my .idea files and reimported the project and the errors went away.
Read more >suzaku-io/boopickle - Gitter
Now I have to figure out how to serialize a fix-point type. ... Pickler for my ADTs substate (that appeared in 5 different...
Read more >Scala | Case Class and Case Object - GeeksforGeeks
A Case Class is just like a regular class, which has a feature for modeling unchangeable data. It is also constructive in pattern...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Serializablehas no effect on BooPickle, it’s just a Java thing 😃And it’s probably better to use
StringsinceInetAddressis indeed not in Scala.jsDo you have a pickler for
InetAddressin the scope?This could also be the old and known limitation of the macro/implicit system (see #21 for a work-around using manually generated picklers) if it’s not the
InetAddress.