Skip to content

Conversation

@JamieMagee
Copy link
Member

This change adds support for System.Text.Json serialization while maintaining backward compatibility with Newtonsoft.Json. TypedComponent and its derived types can now be serialized/deserialized with either JSON library.

This enables gradual migration from Newtonsoft.Json to System.Text.Json without breaking existing serialization code or changing JSON output format.

Related to #231

…ponent`

This change adds support for `System.Text.Json` serialization while maintaining
backward compatibility with `Newtonsoft.Json`. `TypedComponent` and its derived
types can now be serialized/deserialized
with either JSON library.

This enables gradual migration from `Newtonsoft.Json` to `System.Text.Json` without
breaking existing serialization code or changing JSON output format.

Related to #231
@JamieMagee JamieMagee requested a review from a team as a code owner November 21, 2025 22:25
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.2%. Comparing base (de180e0) to head (f003645).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1554   +/-   ##
=====================================
  Coverage   90.2%   90.2%           
=====================================
  Files        426     426           
  Lines      35965   35965           
  Branches    2216    2216           
=====================================
+ Hits       32463   32465    +2     
  Misses      3045    3045           
+ Partials     457     455    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot finished reviewing on behalf of JamieMagee November 21, 2025 22:28
Copy link

Copilot AI left a 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 adds System.Text.Json polymorphic serialization support to the TypedComponent class hierarchy while maintaining backward compatibility with Newtonsoft.Json. The implementation uses the [JsonPolymorphic] and [JsonDerivedType] attributes to enable polymorphic deserialization across all 19 component types.

Key changes:

  • Adds System.Text.Json.Serialization namespace and polymorphic serialization attributes to TypedComponent
  • Registers all 19 derived component types (Cargo, Conan, Conda, DockerImage, DockerReference, DotNet, Git, Go, Linux, Maven, Npm, NuGet, Other, Pip, Pod, RubyGems, Spdx, Swift, Vcpkg) with type discriminators
  • Uses attribute aliasing to distinguish between Newtonsoft.Json and System.Text.Json attributes where they share the same name

@JamieMagee JamieMagee enabled auto-merge (squash) November 21, 2025 22:31
@JamieMagee JamieMagee merged commit 2a8103b into main Nov 21, 2025
33 checks passed
@JamieMagee JamieMagee deleted the users/jamagee/system-text-json-typed-component branch November 21, 2025 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants