rpc-operation-request-body
@azure-tools/typespec-azure-core/rpc-operation-request-bodyWarning for RPC body problems.
Validates 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.
Impact
Section titled “Impact”- Area: API
An RpcOperation with an improperly modeled request body produces an unclear API contract.
❌ 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>;Suppression
Section titled “Suppression”Suppress only when required to match an existing API; otherwise model the request body with the standard patterns.