tapir
tapir copied to clipboard
Relaxed enumeratum codecs
Tapir version: 1.10.5
Scala version: 2.12.12
Describe the bug
The TapirCodecEnumeratum contains two methods
def plainCodecEnumEntryDecodeCaseInsensitive[E <: EnumEntry](implicit `enum`: Enum[E]): Codec.PlainCodec[E] = plainCodecEnumEntryUsing(
`enum`.withNameInsensitiveOption
)
implicit def plainCodecEnumEntry[E <: EnumEntry](implicit `enum`: Enum[E]): Codec.PlainCodec[E] = plainCodecEnumEntryUsing(
`enum`.withNameOption
)
While plainCodecEnumEntry is defined as implicit, I would rather prefer have plainCodecEnumEntryDecodeCaseInsensitive to be the default? Such that for query parameters, path segments and such the case sensitivity is ignored
How to reproduce?
Define a enumeratum enum and use it an query param of path segment while changing the expected casing, it will break fairly easy
Additional information
Is this still relevant, otherwise we could close this?
I don't now :) What's the behavior of other enum codecs? What are the defaults usually? That would need spending some time on to research properly.