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

[Bug][http] can't declare requiredness for meta properties about file part of multipart #3532

Closed
Tracked by #960
msyyc opened this issue Jun 6, 2024 · 1 comment · Fixed by #3538
Closed
Tracked by #960
Assignees
Labels
bug Something isn't working needs-area
Milestone

Comments

@msyyc
Copy link
Contributor

msyyc commented Jun 6, 2024

According to #3046, httpFile could be used to change the requiredness of the optional metadata properties

image

However, when I try the following code, I find the type is Scalar bytes which contains no info about "contentType"/"filename" is required for this file part.

  it("test", async () => {
    const op = await getHttpOp(`

    @Private.httpFile
    model RequiredFileMetadata {
      contentType: string;
      filename: string;
      contents: bytes;
    }
      op read(
        @header contentType: "multipart/mixed",
        @multipartBody body: [
          HttpPart<RequiredFileMetadata, #{ name: "file" }>
        ]): void;
    `);

    const body = op.parameters.body;
    strictEqual(body?.bodyKind, "multipart");
  });

image

@timotheeguerin
Copy link
Member

hhm yeah seems like I didn't handle HttpFile completely

@timotheeguerin timotheeguerin self-assigned this Jun 6, 2024
@timotheeguerin timotheeguerin added the bug Something isn't working label Jun 6, 2024
@timotheeguerin timotheeguerin added this to the [2024] June milestone Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants