**Creating an Optional Payload for File Upload in Effect Typescript**

Hi all,

I want to create an optional payload for a file upload on a HttpApiEndpoint.post(). But when I add Schema.UndefinedOr (Schema.optional gives a type error) I get a runtime error.

.setPayload(
  Schema.UndefinedOr(Schema.Uint8ArrayFromSelf.pipe(
    HttpApiSchema.withEncoding({
      kind: 'Uint8Array',
      contentType: 'application/octet-stream',
    }),
  )),
 )


Error: Missing annotation
details: Generating a JSON Schema for this schema requires a "jsonSchema" annotation
schema (UndefinedKeyword): undefined


1. What annotation does this need?
2. Bonus question: does this load the entire file into memory? If so, can I define it as a stream instead?
Was this page helpful?