microsoft / microsoft/winget-cli
WingetUtil ValidateManifest function support for manifests serialized as json
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Brief description of your issue
Schema header validation for version 1.10.0+ manifests was introduced in PR
- #5126
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 https://github.com/microsoft/winget-cli/issues/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 https://github.com/microsoft/winget-create/issues/456
Steps to reproduce
I guess the most easiest way I know is to
- Bump
Microsoft.WindowsPackageManager.Utilsnuget package to1.10.340 - 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)
Environment
Microsoft.WindowsPackageManager.Utils version 1.10.340
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with WinGetUtil.WinGetValidateManifests() and reproduce the failure using the Microsoft.WindowsPackageManager.Utils 1.10.340 package against JSON singleton and multi-file manifests. Review the linked winget-create E2ETests.cs cases and determine whether JSON $schema recognition or API suppression is appropriate; done means those JSON validation scenarios no longer fail while YAML header validation remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, json
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100