Skip to content

how to interpret body in bodyRoot #4815

Open
@qiaozha

Description

@qiaozha

Playground Link
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
Image

but the type graph shows the later?
Image

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 #2868 (comment) it feels like the former is correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions