Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
8 stars 28 forks source link

[Multipart] Support model format for `@multipartBody` #1090

Open msyyc opened 1 week ago

msyyc commented 1 week ago

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, 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 https://github.com/Azure/typespec-azure/pull/987, mainly for 1 and 2 format. Format 3 will be implemented in another PR.
azure-sdk commented 1 week ago

All changed packages have been documented.

Show changes ### `@azure-tools/typespec-client-generator-core` - _feature_ [✏️](https://github.com/Azure/typespec-azure/edit/multipart-implementation/.chronus/changes/multipart-implementation-2024-5-28-10-50-5.md?pr=/Azure/typespec-azure/pull/1090) > Support model format of `@multipartBody`