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

[TCGC] support advanced feature of multipart #960

Closed
8 tasks done
msyyc opened this issue Jun 6, 2024 · 1 comment
Closed
8 tasks done

[TCGC] support advanced feature of multipart #960

msyyc opened this issue Jun 6, 2024 · 1 comment
Assignees
Labels
feature New feature or request lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@msyyc
Copy link
Member

msyyc commented Jun 6, 2024

After microsoft/typespec#3046, Typespec already supports complete multipart feature, and TCGC needs to adopt it.

Bug in Typespec

  1. bug needs-area
    timotheeguerin
  2. needs-area
    bterlson
  3. bug lib:http triaged:core
    timotheeguerin

Feature

  1. feature lib:tcgc
    msyyc
  2. docs lib:tcgc
    msyyc

TCGC API design

  1. lib:tcgc

TCGC Implementation

Cadl-Ranch Test

@msyyc msyyc added feature New feature or request lib:tcgc Issues for @azure-tools/typespec-client-generator-core library labels Jun 6, 2024
@msyyc msyyc self-assigned this Jun 6, 2024
@msyyc
Copy link
Member Author

msyyc commented Jun 6, 2024

Currently TCGC only has boolean flag isMultipartFileInput, which is not enough to support some new features of multipart in Typespec. As first step, we shall design new TCGC API for multipart.

msyyc added a commit that referenced this issue Jul 24, 2024
- fixes part of #960
- Pending on microsoft/typespec#3676

Context: 
Typespec supports 3 kinds of format to define multipart:
1. common
```

op upload(
  @Header `content-type`: "multipart/form-data",
  @Body body: {
    basic: string,
    headShots: bytes[],
  }
): void;
```

2. advanced model format
```
op upload(
  @Header `content-type`: "multipart/form-data",
  @multipartBody body: {
    fullName: HttpPart<string>,
    headShots: HttpPart<bytes[]>
  }
): void;
```

3. advanced array format
```
op upload(
  @Header `content-type`: "multipart/form-data",
  @multipartBody body: [
    // single
    HttpPart<string, #{ name: "fullName" }>,
    HttpPart<bytes[], #{ name: "headShots" }>,
  ]
): void;
```
- This PR is implementation for API design
#987, mainly for 1 and 2
format. Format 3 will be implemented in another PR.
@iscai-msft iscai-msft added this to the [2024] September milestone Aug 7, 2024
@markcowl markcowl removed this from the [2024] September milestone Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request lib:tcgc Issues for @azure-tools/typespec-client-generator-core library
Projects
None yet
Development

No branches or pull requests

4 participants