-
Notifications
You must be signed in to change notification settings - Fork 167
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.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object sent as part of additionalProperties for New-MgExternalConnection truncated #2352
Comments
Thanks for following up on this. You will need to store the # Initialize to an empty hashtable to explicitly define the type as hashtable.
# This is needed to avoid the breaking change introduced in PowerShell 7.3 - https://github.com/PowerShell/PowerShell/issues/18524.
[hashtable]$adaptiveCard = @{}
$adaptiveCard += Get-Content -Path ".\resultLayout.json" -Raw | ConvertFrom-Json -AsHashtable # Use -AsHashtable to convert the JSON to a hashtable. The code generator exposes additionalProperties, complex types (with no properties) & open types as hashtable types - https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.search/new-mgexternalconnection?view=graph-powershell-1.0#-additionalproperties.
...
searchSettings = @{
searchResultTemplates = @(
@{
id = "waldekblogpwsh"
priority = 1
layout = $adaptiveCard # Assign the hashtable directly to the layout property.
}
)
} The code generator, AutoREST.PowerShell, uses The inconsistency between PSObject or Hashtable types is external to the SDK as it emanates from the code generator, AutoREST. The inconsistency is being tracked at #1659. |
@peombwa should we think about offering a custom "ConvertFrom-Json" that handles these cases? It feels we're leaking some of our implementation / dependency details that are not necessary for developers to know about. Adding @CarolKigoonya to this thread. |
Thank you @peombwa! I can confirm that the solution you proposed works. |
Describe the bug
Object sent as part of additionalProperties for New-MgExternalConnection truncated
To Reproduce
.\Initialize-ExternalConnection.ps1
Expected behavior
New external connection created with a result template
Debug Output
Please note, that the error only shows the last call failing. Before, there's another request that's failing with a 503 request that's not logged in PowerShell, but which you can see if you use a local proxy like Fiddler.
Module Version
2.6.1
Environment Data
Name Value
PSVersion 7.3.7
PSEdition Core
GitCommitId 7.3.7
OS Darwin 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Screenshots
See how the value of the additionalProperties property is 1) stored as a string and 2) truncated
Additional context
FWIW, the same approach works just fine with the Graph .NET SDK
The text was updated successfully, but these errors were encountered: