-
Notifications
You must be signed in to change notification settings - Fork 113
Migrate vcpkg and Go detectors from Newtonsoft.Json to System.TextJson
#1570
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1570 +/- ##
=======================================
- Coverage 89.5% 89.1% -0.5%
=======================================
Files 427 428 +1
Lines 36270 36561 +291
Branches 2262 2271 +9
=======================================
+ Hits 32496 32608 +112
- Misses 3311 3494 +183
+ Partials 463 459 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the vcpkg and Go detectors from Newtonsoft.Json to System.Text.Json, continuing the broader effort tracked in #231 to standardize on the built-in JSON library. The changes replace JsonConvert.DeserializeObject with JsonSerializer.Deserialize in vcpkg, implement a custom multi-JSON-object parser for Go CLI output using Utf8JsonReader, and add explicit [JsonPropertyName] attributes to vcpkg contract classes to match the SPDX 2.2.1 schema.
Key changes:
- VcpkgComponentDetector replaces Newtonsoft.Json deserialization calls with System.Text.Json equivalents
- GoCLIParser implements custom parsing logic for Go CLI's multi-object JSON output (newline-separated JSON objects)
- All vcpkg contract classes receive explicit JsonPropertyName attributes matching SPDX field names
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.ComponentDetection.Detectors/vcpkg/VcpkgComponentDetector.cs | Replaces JsonConvert.DeserializeObject calls with JsonSerializer.Deserialize, removes Newtonsoft.Json using statement |
| src/Microsoft.ComponentDetection.Detectors/vcpkg/Contracts/VcpkgSBOM.cs | Adds JsonPropertyName attributes for packages and name properties |
| src/Microsoft.ComponentDetection.Detectors/vcpkg/Contracts/Package.cs | Adds JsonPropertyName attributes for all properties matching SPDX 2.2.1 schema |
| src/Microsoft.ComponentDetection.Detectors/vcpkg/Contracts/ManifestInfo.cs | Removes duplicate Newtonsoft.Json attribute, keeps System.Text.Json attribute |
| src/Microsoft.ComponentDetection.Detectors/vcpkg/Contracts/Annotation.cs | Adds JsonPropertyName attributes for all properties matching SPDX schema |
| src/Microsoft.ComponentDetection.Detectors/go/Parsers/GoCLIParser.cs | Replaces Newtonsoft.Json's JsonTextReader with custom Utf8JsonReader loop for parsing multi-object JSON output |
src/Microsoft.ComponentDetection.Detectors/go/Parsers/GoCLIParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/go/Parsers/GoCLIParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/go/Parsers/GoCLIParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/vcpkg/Contracts/Annotation.cs
Show resolved
Hide resolved
|
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
….Json` - `VcpkgComponentDetector`: Replace `JsonConvert.DeserializeObject` with `JsonSerializer.Deserialize` - `GoCLIParser`: Replace `JsonTextReader`/`JsonSerializer` with `Utf8JsonReader` for parsing multi-object JSON output from `go list` - .NET 9 added `AllowMultipleValues`, but unfortunately we are still on .NET 8 - Add explicit `[JsonPropertyName]` attributes to vcpkg contract classes using SPDX 2.2.1 schema field names
b4866a8 to
e2e6ff6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
0ab5ebf to
b7ebff5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
b7ebff5 to
bd4dcaa
Compare
VcpkgComponentDetector: ReplaceJsonConvert.DeserializeObjectwithJsonSerializer.DeserializeGoCLIParser: ReplaceJsonTextReader/JsonSerializerwithUtf8JsonReaderfor parsing multi-object JSON output fromgo listAllowMultipleValues, but unfortunately we are still on .NET 8[JsonPropertyName]attributes to vcpkg contract classes using SPDX 2.2.1 schema field namesPart of #231