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

Enum in HttpApi URL Params is not correctly decoded and returns an HttpApiDecodeError #4471

Closed
wewelll opened this issue Feb 18, 2025 · 1 comment · Fixed by #4457
Closed
Assignees
Labels
bug Something isn't working

Comments

@wewelll
Copy link
Contributor

wewelll commented Feb 18, 2025

What version of Effect is running?

3.13.1

What steps can reproduce the bug?

Reproduction on Effect playground: https://effect.website/play#bfe492b50bb7

I define an HttpApi like this:

const MyApi = HttpApi.make("api").add(
  HttpApiGroup.make("group").add(
    HttpApiEndpoint.get("endpoint")`/`.setUrlParams(
      Schema.Struct({
        enum: Schema.Enums(TestEnum),
        date: Schema.optionalWith(Schema.Date, { exact: true })
      })
    ).addSuccess(Schema.String)
  )
)

When calling my endpoint using the client, I see this error:

 HttpApiDecodeError: { readonly enum: <enum 2 value(s): 0 | 1>; readonly date?: Date }
  └─ ["enum"]
     └─ Expected <enum 2 value(s): 0 | 1>, actual ["first"]

What is the expected behavior?

It should decode the enum correctly

What do you see instead?

No response

Additional information

The bug is not present on @effect/platform 0.75.4, but is present on the version 0.77.1.

I guess that it could be linked to this recent commit @gcanti from c407726

@wewelll wewelll added the bug Something isn't working label Feb 18, 2025
@gcanti gcanti self-assigned this Feb 18, 2025
@gcanti gcanti closed this as completed in 31be72a Feb 18, 2025
@gcanti
Copy link
Contributor

gcanti commented Feb 18, 2025

@wewelll thanks for reporting, patch released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants