You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set request body to optional when all properties are optional #582
In a scenario where all the properties in the request body are optional such as an odata action with all parameters being optional, we should set the requestBody.required = false in the generated openApi description otherwise explictly set it to true.
This will unlock the generation of request body parameters in the SDKs as optional parameters in the builders to prevent breaking changes in scenarios where optional parametes are added.
Trying to retrieve the annotations in-lined in the Action parameters fails to retrieve the Org.OData.Core.V1.OptionalParameter annotation using the extensions from the Edm lib.
So, Gavin Barron (@gavinbarron) mentions in #3318 that this issue is related to the Restore-MgBetaDirectoryDeletedItem no longer having a -BodyParameter option, rendering all optional body parameters un-usable.
Gavin also mentioned MANY API calls all got optional BodyParameters added to them - does this mean ALL of the Powershell SDK auto-generated commands for those APIs are now broken in the sense that they have no -bodyparameter option?
Adam Johnson (@zaaj) the cmdlets that are impacted by this are those which originally did not have any body parameters and had them introduced.
And for directory scenarios, that's quite a few. I'm currently working on the feature that is required here before we can look at getting a fix into the Microsoft Graph SDKs
Activity
andrueastman commentedon Sep 25, 2024
Once this is fixed and released, we should revert this PR.
microsoftgraph/msgraph-metadata#697
andrueastman commentedon Oct 2, 2024
Updated the description here. Should be Odata
actionnotfunction. Functions do not have request bodies as the parameters are in the path.irvinesunday commentedon Oct 2, 2024
Also, point of note is that, if
requestBody.required = falsethe OAS does not emit therequiredproperty in therequestBodyschema.andrueastman commentedon Oct 2, 2024
According to the spec.
So what we should do is set it to true when required parameters are present...
irvinesunday commentedon Oct 3, 2024
Trying to retrieve the annotations in-lined in the Action parameters fails to retrieve the
Org.OData.Core.V1.OptionalParameterannotation using the extensions from the Edm lib.Checking with the OData team to check for its support.
zaaj commentedon Dec 23, 2025
So, Gavin Barron (@gavinbarron) mentions in #3318 that this issue is related to the Restore-MgBetaDirectoryDeletedItem no longer having a -BodyParameter option, rendering all optional body parameters un-usable.
Gavin also mentioned MANY API calls all got optional BodyParameters added to them - does this mean ALL of the Powershell SDK auto-generated commands for those APIs are now broken in the sense that they have no -bodyparameter option?
gavinbarron commentedon Jan 15, 2026
Adam Johnson (@zaaj) the cmdlets that are impacted by this are those which originally did not have any body parameters and had them introduced.
And for directory scenarios, that's quite a few. I'm currently working on the feature that is required here before we can look at getting a fix into the Microsoft Graph SDKs