rpc-operation-request-body
@azure-tools/typespec-azure-core/rpc-operation-request-bodyValidates that RpcOperation request bodies are used correctly. Operations using HTTP verbs that do not support a body (like GET or DELETE) should not define one.
โ Incorrect
Section titled โโ IncorrectโGET operation with a request body:
@getop getWidget is RpcOperation< { @body body: Widget; }, Widget>;DELETE operation with a request body:
@deleteop deleteWidget is RpcOperation< { @body body: Widget; }, Widget>;โ Correct
Section titled โโ CorrectโGET operation with no body:
@getop getWidget is RpcOperation<{}, Widget>;DELETE operation with no body:
@deleteop deleteWidget is RpcOperation<{}, Widget>;GET/DELETE with query parameters using @bodyIgnore:
@getop get is RpcOperation< { @bodyIgnore options: { @query foo: string; }; }, {}>;POST operation with a body:
@postop createWidget is RpcOperation< { @body body: Widget; }, Widget>;