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
responses from functions with returntype collection are not being parsed as openApiDocs YML are not representing function return types correctly as OData message bodies
#665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Each message body is represented as a single JSON object. This object is either ... or it contains a name/value pair whose name MUST be value and whose value is the correct representation for ... a collection of entities, or a collection of objects that represent changes to a previous result.
However this cmdlet fails to process the response from Microsoft graph
DEBUG: CmdletException: InvalidCastException - Unable to cast object of type
'Microsoft.Graph.PowerShell.Runtime.Json.JsonObject' to type 'Microsoft.Graph.PowerShell.Runtime.Json.JsonArray'. : at Microsoft.Graph.PowerShell.Runtime.Json.JsonArray.Parse(String text)
at Microsoft.Graph.PowerShell.Reports.<>c.<ReportsGetCredentialUsageSummary_Call>b__158_0(Task`1 body)
that causes the cmdlet to fail.
Get-MgReportCredentialUsageSummary_Get: Unable to cast object of type 'Microsoft.Graph.PowerShell.Runtime.Json.JsonObject' to type 'Microsoft.Graph.PowerShell.Runtime.Json.JsonArray'.
I observed the same behavior with an identity governance cmdlet Invoke-MgFilterEntitlementManagementAccessPackage -On "'allowedRequestor'" also failing with the same error, and observed that the stack trace included a call to JsonArray.Parse in IdentityGovernance.cs
body => If( Microsoft.Graph.PowerShell.Runtime.Json.JsonArray.Parse(body.Result)
I believe this may be due to an issue in the openapidocs/*.yml files. I observed the functions had a response pattern that looked like
Uh oh!
There was an error while loading. Please reload this page.
For example
Get-MgReportCredentialUsageSummary -Period "D30" -Verbose -Debug
sends the correct request according to https://docs.microsoft.com/en-us/graph/api/reportroot-getcredentialusagesummary?view=graph-rest-beta&tabs=http
The metadata indicates that function returns
<ReturnType Type="Collection(graph.credentialUsageSummary)" Nullable="false" />
and the response is formatted according to OData 4,However this cmdlet fails to process the response from Microsoft graph
with an error of
that causes the cmdlet to fail.
I observed the same behavior with an identity governance cmdlet
Invoke-MgFilterEntitlementManagementAccessPackage -On "'allowedRequestor'"
also failing with the same error, and observed that the stack trace included a call to JsonArray.Parse in IdentityGovernance.csI believe this may be due to an issue in the openapidocs/*.yml files. I observed the functions had a response pattern that looked like
rather than
and similarly Reports.yml had
whereas I would have expected
AB#9483
The text was updated successfully, but these errors were encountered: