Questions tagged [enumeratum]

A type-safe, reflection-free, powerful enumeration implementation for Scala with exhaustive pattern match warnings and helpful integrations.

8 questions
6
votes
0 answers

boilerplate free projection of case class to change data type of enum

I have an Enumeratum enum and need to load it into a spark data frame. Obviously, this fails due to a missing encoder. import enumeratum._ sealed trait Foo extends EnumEntry object Foo extends Enum[Foo] { val values = findValues case object…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
2
votes
1 answer

Using an Enumeratum Enum in a Map does not work

I have an Enumeration created with enumeratum: sealed trait Language extends EnumEntry object Language extends Enum[Language] with PlayInsensitiveJsonEnum[Language] { val values: IndexedSeq[Language] = findValues case object DE extends…
pme
  • 14,156
  • 3
  • 52
  • 95
1
vote
1 answer

How to get a simple string encoding for Enumeratum enum in Zio-JSON

So lets say I have a simple enumeratum based enum. import enumeratum._ sealed trait Fruit extends EnumEntry object Fruit extends Enum[Fruit] { override val values: IndexedSeq[Fruit] = findValues case object Avocado extends Fruit …
Peter Lamberg
  • 8,151
  • 3
  • 55
  • 69
1
vote
0 answers

Override toString in scala enumeratum

Let's say I have the following enum defined: import enumeratum._ import enumeratum.EnumEntry.Lowercase import scala.collection.immutable sealed trait Day extends EnumEntry with Lowercase object Day extends Enum[Day]{ case object MON extends…
Andrii Abramov
  • 10,019
  • 9
  • 74
  • 96
1
vote
1 answer

Enumeratum Circe Serialisation

I have a simple case class like so: case class ColumnMetadata(name: String, displayName: String, description: Option[String], attributeType: AttributeType) sealed trait…
Chris Johnston
  • 335
  • 1
  • 2
  • 16
1
vote
0 answers

Use optional StringEnumEntry field in case class with Quill in Scala

We're using enumeratum successfully when dealing with enum values, both with Circe and with Quill. We define something like this: sealed abstract class TopicType(val value: String) extends StringEnumEntry object TopicType extends…
simen-andresen
  • 2,217
  • 4
  • 25
  • 39
1
vote
0 answers

pureconfig Enumeratum nicer exceptions

How can I get nicer exceptions when using pureconfig with Enumeratum? https://github.com/pureconfig/pureconfig/tree/master/modules/enumeratum import pureconfig._ import pureconfig.generic.auto._ import pureconfig.module.enumeratum._ import…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
0
votes
1 answer

Implementing Config class containing Enum Map by PureConfig and Enumeratum

I'm trying to read my config file into my case class whose one of attribute is a Map of Enumeratum key and Case Class value by using pureconfig and pureconfig-enumeratum libraries version 0.14.0 with scala 2.11. When I change the Map key from…
gabby
  • 629
  • 2
  • 11
  • 34