Effect CommunityEC
Effect Community10mo ago
4 replies
tobi88

Using Union of String Literals for URL Parameters in HttpApiEndpoint Schema Definition

Has anyone tried to set a union of string literals as Schema definition for URL parameters in HttpApiEndpoint? It seems only string values are allowed at this time. https://github.com/Effect-TS/effect/blob/main/packages/platform/README.md#setting-url-parameters

Here is what I was trying to do:

const getUsers = HttpApiEndpoint.get("getUsers", "/users")
  // Specify the URL parameters schema
  .setUrlParams(
    Schema.Struct({
      action: Schema.Literal("a", "b", "c")
    })
  )
.addSuccess(Schema.Array(User))
Was this page helpful?