Closed msyyc closed 1 month ago
The root cause is that TCGC always set a model with UsageFlags.Input
: https://github.com/Azure/typespec-azure/blob/a6365a1770d07b763f5ae9805374cda11085e180/packages/typespec-client-generator-core/src/types.ts#L1658 so it is not proper to distinguish whether a model is used both in common content-type and multipart content-type: https://github.com/Azure/typespec-azure/blob/a6365a1770d07b763f5ae9805374cda11085e180/packages/typespec-client-generator-core/src/types.ts#L1633-L1642.
There are 2 solutions:
Input
and MultipartFormData
excludedNonMultiPart
Personal opinion:
Make MultipartFormData
exclusive to JSON
/XML
, as all of these relates to the serialization of the model.
Personal opinion: Make
MultipartFormData
exclusive toJSON
/XML
, as all of these relates to the serialization of the model.
After discussion, we pretend to use this solution instead of adding new usage kind. Let me make a PR to fix it later.
Describe the bug
For the valid cases, TCGC reports wrong diagnostics "conflicting-multipart-model-usage"
Reproduction
Checklist