Skip to content

Microsoft.Graph.Authentication: 5+ MB of whitespace in MgCommandMetadata.json #3345

Open
@sean-r-williams

Description

@sean-r-williams

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

  1. Install from PSGallery
  2. Import-Module Microsoft.Graph.Authentication
  3. Get-Module Microsoft.Graph.Authentication | % ModuleBase | join-path -childpath "custom" -AdditionalChildPath "common","MgCommandMetadata.json" | Set-Variable FilePath
  4. Get-Item -LiteralPath $FilePath | % Length | Set-Variable CurrentLength
  5. Get-Content -LiteralPath $FilePath -Raw | ConvertFrom-Json -Depth 100 | ConvertTo-Json -Depth 100 -Compress | Set-Variable CompressedLength
  6. $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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions