microsoft-graph-devx-api icon indicating copy to clipboard operation
microsoft-graph-devx-api copied to clipboard

Create forward snippet should create an empty type rather than null.

Open andrueastman opened this issue 6 months ago • 0 comments

Taking a look at the snippet at https://learn.microsoft.com/en-us/graph/api/message-createforward?view=graph-rest-1.0&tabs=csharp#example-1-create-a-draft-message-in-json-format-to-forward-an-existing-message

var result = await graphClient.Me.Messages["{message-id}"].CreateForward.PostAsync(null);

The snippet generated compiles but fails to run due to the validation of the PostAsync checking for null. Since the body is null, the generator should create an empty parameter as

var result = await graphClient.Me.Messages["{message-id}"].CreateForward.PostAsync(new CreateForwardPostRequestBody());

Sourced from https://github.com/microsoftgraph/microsoft-graph-docs-contrib/pull/9068

andrueastman avatar Jan 31 '24 08:01 andrueastman