microsoft / microsoft/typespec
how to interpret body in bodyRoot
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
[Playground Link](https://cadlplayground.z22.web.core.windows.net/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7DQoNCnVzaW5nIEh0dHA7DQpvcCB0ZXN0KEBib2R5Um9vdCDECToge8URxw1UZXN0fSk6IHZvaWTFQ21vZGVsxRcgew0KICBwcm9wOnN0cmluZzsNCn0%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
In this tsp
```
op test(@bodyRoot body: {@body body: Test}): void;
```
is the body parameter Test or an anonymous model with a property named body whose type is Test?
the openapi3 emitter result shows the former

but the type graph shows the later?

it's a real case https://github.com/Azure/azure-rest-api-specs/blob/ca4b71ab0e3bb7e4c44b44bf4d84d9c51f7b8264/specification/workloads/Workloads.SAPVirtualInstance.Management/SAPCentralServerInstance.tsp#L61, and seems quite common as azure operation template uses bodyRoot here
https://github.com/Azure/typespec-azure/blob/main/packages/typespec-azure-resource-manager/lib/operations.tsp#L502
According to https://github.com/microsoft/typespec/issues/2868#issue-2110782074 it feels like the former is correct?
Contributor guide
Assessment
This issue has not been assessed yet.