Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relaxed enumeratum codecs #3711

Open
Fristi opened this issue Apr 22, 2024 · 2 comments
Open

Relaxed enumeratum codecs #3711

Fristi opened this issue Apr 22, 2024 · 2 comments

Comments

@Fristi
Copy link

Fristi commented Apr 22, 2024

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

@Fristi Fristi changed the title [BUG] Relaxed enumeratum codecs Apr 22, 2024
@Fristi
Copy link
Author

Fristi commented May 14, 2024

Is this still relevant, otherwise we could close this?

@adamw
Copy link
Member

adamw commented May 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants