Describe the bug
My team is trying to use Microsoft.Graph (.Authentication and .Users) in a space-constrained environment (AWS Lambda functions) where our code, dependencies, and PowerShell proper must be <250 MB.
Microsoft.Graph.Authentication is the largest dependency we have (42 MB unzipped for v2.28). Most of this is in .\custom\common\MgCommandMetadata.json, which is 25MB of JSON created with ConvertTo-Json.
Because -Compress wasn't specified, MgCommandMetadata.json contains ~5.86MB (roughly 23%) of whitespace and formatting/indent characters. This file is too big for humans to read anyways, so the extra formatting characters are just taking up space.
Expected behavior
NewCommandMetadata.ps1 calls ConvertTo-Json with -Compress (or the process generating this JSON file otherwise compresses the output)
How to reproduce
- Install from PSGallery
Import-Module Microsoft.Graph.Authentication
Get-Module Microsoft.Graph.Authentication | % ModuleBase | join-path -childpath "custom" -AdditionalChildPath "common","MgCommandMetadata.json" | Set-Variable FilePath
Get-Item -LiteralPath $FilePath | % Length | Set-Variable CurrentLength
Get-Content -LiteralPath $FilePath -Raw | ConvertFrom-Json -Depth 100 | ConvertTo-Json -Depth 100 -Compress | Set-Variable CompressedLength
$CurrentLength - $CompressedLength
SDK Version
2.28.0
Latest version known to work for scenario above?
N/A
Known Workarounds
N/A
Debug output
N/A
Configuration
N/A
Other information
No response
Describe the bug
My team is trying to use
Microsoft.Graph(.Authenticationand.Users) in a space-constrained environment (AWS Lambda functions) where our code, dependencies, and PowerShell proper must be <250 MB.Microsoft.Graph.Authentication is the largest dependency we have (42 MB unzipped for v2.28). Most of this is in
.\custom\common\MgCommandMetadata.json, which is 25MB of JSON created withConvertTo-Json.Because
-Compresswasn't specified,MgCommandMetadata.jsoncontains ~5.86MB (roughly 23%) of whitespace and formatting/indent characters. This file is too big for humans to read anyways, so the extra formatting characters are just taking up space.Expected behavior
NewCommandMetadata.ps1 calls
ConvertTo-Jsonwith-Compress(or the process generating this JSON file otherwise compresses the output)How to reproduce
Import-Module Microsoft.Graph.AuthenticationGet-Module Microsoft.Graph.Authentication | % ModuleBase | join-path -childpath "custom" -AdditionalChildPath "common","MgCommandMetadata.json" | Set-Variable FilePathGet-Item -LiteralPath $FilePath | % Length | Set-Variable CurrentLengthGet-Content -LiteralPath $FilePath -Raw | ConvertFrom-Json -Depth 100 | ConvertTo-Json -Depth 100 -Compress | Set-Variable CompressedLength$CurrentLength - $CompressedLengthSDK Version
2.28.0
Latest version known to work for scenario above?
N/A
Known Workarounds
N/A
Debug output
N/A
Configuration
N/A
Other information
No response