avast / avast/cactus

Proper support for sealed trait case classes with oneof

Open
#33 0 comments 0 reactions 1 assignee Claimed by @jendakol View on GitHub
enhancement
Dominant language
Scala
Stars
9
Forks
5
PR merge metrics
No merged PRs in 30d

Description

The current implementation needs a _wrapper_ case-class that holds the actual value in the `value` field. It's OK for primitive types but it adds unnecessary layer if we are working with full-featured case-classes.

Example that would be nice to work:
```scala
sealed trait JobState
object JobState {
case object Waiting extends JobState
case class Running(data: String) extends JobState
case object Completed extends JobState
}
```
```gpb
message Data {
oneof job_state {
bool waiting = 1; // the type bool is randomly choosen - it's just a marker
Running running = 2;
bool completed = 3;
}
message Running {
string data = 1;
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.