microsoft / microsoft/typespec
Add support for declaring optional part in the tuple form
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
According to https://github.com/microsoft/typespec/issues/3046, multipart supports two kind of format:
✅ model format
```
op upload(
@header `content-type`: "multipart/form-data",
@multipartBody body: {
// # String body
fullName: HttpPart,
headShots: HttpPart[]
}
): void;
```
❌ array format:
```
op upload(
@header `content-type`: "multipart/form-data",
@multipartBody body: [
// # String body
HttpPart
]): void;
```
However, with array format, it is hard to declare the part is "optional". I try to add `?` with `HttpPart?` and `HttpPart` but compiler reports error.
I think the following format shall work:

But http parse result is still `optional: false`. I think it is a bug?
Contributor guide
Assessment
This issue has not been assessed yet.