Skip to content

spread-json-merge-patch-payload-not-supported

Id
@azure-tools/typespec-java/spread-json-merge-patch-payload-not-supported

Severity: warning

This diagnostic is issued when an operation spreads a JSON merge-patch body into method parameters.

The body is kept as a model parameter because separate Java parameters cannot distinguish an omitted property from a property explicitly set to null.

model WidgetPatch {
name?: string | null;
}
@patch
op update(@header contentType: "application/merge-patch+json", ...WidgetPatch): void;
Spread JSON merge-patch payload is not supported.

Pass the patch model as the request body instead of spreading its properties.

@patch
op update(@header contentType: "application/merge-patch+json", @body body: WidgetPatch): void;

This warning should not be suppressed because the generated method shape intentionally changes to preserve merge-patch semantics.