effect
effect copied to clipboard
Empty array in HttpApi URL Params is not correctly decoded and returns an HttpApiDecodeError
What version of Effect is running?
3.14.18
What steps can reproduce the bug?
Reproduction on Effect playground: https://effect.website/play#6157b14ba502
I define an API like this:
const MyApi = HttpApi.make("api").add(
HttpApiGroup.make("group").add(
HttpApiEndpoint.get("endpoint")`/`.setUrlParams(
Schema.Struct({
arrayOfString: Schema.Array(Schema.String)
})
).addSuccess(Schema.String)
)
)
When calling this endpoint with an empty array, I have this error returned by the server:
HttpApiDecodeError: { readonly arrayOfString: ReadonlyArray<string> }
└─ ["arrayOfString"]
└─ is missing
This happens because when the array is empty, there is no urlParam at all.
What is the expected behavior?
When one of the url param is an array, we should decode "no url param" as a "empty array"
What do you see instead?
No response
Additional information
No response