microsoft / microsoft/typespec

Can `HttpPart` be used in request that content-type is not "multipart/*"?

Open
#6,530 1 comment 0 reactions 0 assignees View on GitHub
feature lib:http triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

`HttpPart` is designed content-type `multipart/*` (design issue is [here](https://github.com/microsoft/typespec/issues/3046)), while tsp compiler doesn't report error when it is used in request that content-type is not "multipart/*". (e.g. [Playground](https://typespec.io/playground/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7Cgp1c2luZyBUeXBlU3BlYy5IdHRwOwpAc2VydmljZSgjeyB0aXRsZTogIldpZGdldCBTxhoiIH0pCm5hbWVzcGFjZSBEZW1vxxo7CgogICAgbW9kZWwgTXVsdGlQYXJ0UmVxdWVzdCB7xR0gIHByb2ZpbGVJbWFnZXM6IMR3xCc8Ynl0ZXM%2BO8cmYWRkcmVzc80iQcYUxyR9y23HGslkY2l0eTogc3RyaW5nyC7FBy8vIEBwb3N0yA1vcCB1cGxvYWQoQGhlYWRlciBjb250ZW505AEXOiAibeQAxnBhcnQvZm9ybS1kYXRhIiwgQMkXQm9keSBib2R5OvEA8Sk6IHZvaWTnARXKdkByb3V0ZSgiL25ldyIpxRPpAIZOZXcoLi4u3ksvL%2BcA9kpzb27uAV4vL%2FIBYeUBWOYBBcUf6wFa5wE3yR33ASXsALIy5wCz7AE8TmV3MuQAt%2BsAkOkAsg%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%22linterRuleSet%22%3A%7B%22extends%22%3A%5B%22%40typespec%2Fhttp%2Fall%22%5D%7D%7D))

Then the question is:
- Is it valid that `HttpPart` is used in common content-type?

If no, tsp compiler shall report error.
If yes, how does emitter generate openapi/ SDK? Now the generated openapi.yaml seems not right:

![Image](https://github.com/user-attachments/assets/55ad5e3e-5fb0-42f7-9e1c-82386e80f8d3)

cc @allenjzhang / @timotheeguerin

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.