Repository navigation
Add MetadataFieldStjConverter with parity tests - #7355
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new System.Text.Json converter for metadata fields in NuGet.Protocol, plus parity-style tests intended to compare its behavior against the existing Newtonsoft-based converter. It also adds the localized resource string used for unexpected-token failures as part of the ongoing NSJ → STJ migration.
Changes:
- Added
MetadataFieldStjConverterto read metadata fields from JSON strings or arrays into a comma-separated string. - Added
MetadataFieldStjConverterTeststo compare STJ and NSJ behavior across several valid and invalid payload shapes. - Added
Error_UnexpectedJsonTokentoStrings.resx, regeneratedStrings.Designer.cs, and included generated.xlfupdates.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/NuGet.Core.Tests/NuGet.Protocol.Tests/Converters/MetadataFieldStjConverterTests.cs |
Adds parity-oriented tests for the new STJ converter. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.zh-Hant.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.zh-Hans.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.tr.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.ru.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.pt-BR.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.pl.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.ko.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.ja.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.it.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.fr.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.es.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.de.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/xlf/Strings.cs.xlf |
Generated localization entry for the new error string. |
src/NuGet.Core/NuGet.Protocol/Strings.resx |
Adds the source resource string for unexpected JSON token errors. |
src/NuGet.Core/NuGet.Protocol/Strings.Designer.cs |
Regenerated resource accessor for the new string. |
src/NuGet.Core/NuGet.Protocol/Converters/MetadataFieldStjConverter.cs |
Implements the new STJ metadata-field converter. |
Files not reviewed (1)
- src/NuGet.Core/NuGet.Protocol/Strings.Designer.cs: Language not supported
|
@copilot resolve the merge conflicts in this pull request |
Resolved. The conflicts were in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
e346b27 to
d5150f2
Compare
|
merge conflict resolution with copilot got a bit messy but fixed manually now. |
9ddcc35 to
ce4385a
Compare
ce4385a to
e129389
Compare
|
I needed a rebase to fix CI. Squashed (to avoid multiple merge conflicts) and rebased. |
Bug
Fixes: NuGet/Home#14883
Related: NuGet/Home#14846
Description
This is a focused slice of #7301, split per-converter to make reviewing
easier.
Converters are being migrated first so that the upcoming Registration resource migrations don't become bloated PRs.
Ensures
MetadataFieldStjConverterbehaves identically to the NSJMetadataFieldConverterfor all input types, and addsparity tests that run both converters side-by-side to verify the outputs match.
PR Checklist