Skip to content

WingetUtil ValidateManifest function support for manifests serialized as json #5336

@mdanish-kh

Description

@mdanish-kh

Brief description of your issue

Schema header validation for version 1.10.0+ manifests was introduced in PR

The implementation was such that the validation would be treated as warnings for the CLI usage, but as errors if invoked via the WinGetUtil.WinGetValidateManifests() API. The header validation seems to be only pertinent to YAML manifests, as the validate command does not recognize the corresponding $schema field used in a JSON variant of the manifest ( see another issue about this #4150 ). Because of this, WinGetValidateManifests() errors out when dealing with JSON manifests. This is most relevant to winget-create which supports updating and submitting JSON manifests to a private repo (it won't allow submitting JSON to the community repository). The change breaks the winget-create's ability to submit JSON manifests. See relevant E2E tests that fail after this change

btw if one is wondering why winget-create would need to support JSON in the first place, it was a feature request from someone whose private repo accepted only JSON. See microsoft/winget-create#456

Steps to reproduce

I guess the most easiest way I know is to

  1. Bump Microsoft.WindowsPackageManager.Utils nuget package to 1.10.340
  2. Call WinGetUtil.WinGetValidateManifests() on a JSON singleton / multi-file manifest.

That's exactly what I did in this PR when bumping winget-create to support 1.10.0 schema version. One can just checkout the code in that PR and try to run the E2E tests.

Expected behavior

Either the validation to recognize the $schema field in the JSON manifest, or have a way in the WinGetUtil API to suppress header validation?

Actual behavior

Fails with a manifest error

Screenshot (click to open)

Image

Environment

Microsoft.WindowsPackageManager.Utils version 1.10.340

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureThis is a feature request for the Windows Package Manager client.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions