Skip to content

Add MetadataFieldStjConverter with parity tests - #7355

Merged
Nigusu-Allehu merged 1 commit into
devfrom
dev-nyenework-stj-metadata-field-converter
May 6, 2026
Merged

Nigusu-Allehu merged 1 commit into
devfrom
dev-nyenework-stj-metadata-field-converter

Conversation

@Nigusu-Allehu

@Nigusu-Allehu Nigusu-Allehu commented May 3, 2026 •

Copy link
Copy Markdown
Member

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 MetadataFieldStjConverter behaves identically to the NSJ MetadataFieldConverter for all input types, and adds
parity tests that run both converters side-by-side to verify the outputs match.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@Nigusu-Allehu Nigusu-Allehu self-assigned this May 4, 2026
@Nigusu-Allehu
Nigusu-Allehu marked this pull request as ready for review May 4, 2026 00:38
@Nigusu-Allehu
Nigusu-Allehu requested a review from a team as a code owner May 4, 2026 00:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 MetadataFieldStjConverter to read metadata fields from JSON strings or arrays into a comma-separated string.
  • Added MetadataFieldStjConverterTests to compare STJ and NSJ behavior across several valid and invalid payload shapes.
  • Added Error_UnexpectedJsonToken to Strings.resx, regenerated Strings.Designer.cs, and included generated .xlf updates.

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 AI left a comment

Copy link
Copy Markdown
Contributor

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 17 out of 18 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/NuGet.Core/NuGet.Protocol/Strings.Designer.cs: Language not supported

jeffkl
jeffkl previously approved these changes May 5, 2026
jeffkl
jeffkl previously approved these changes May 5, 2026
@Nigusu-Allehu

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved. The conflicts were in Strings.resx, Strings.Designer.cs, and all 13 .xlf files, where both branches added a new string entry after Error_PackageIdentityDoesNotMatch. The merge keeps both Error_RequiredJsonPropertyMissing (from dev) and Error_UnexpectedJsonToken (from this branch) in alphabetical order — commit e346b27.

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:

  • data.nuget.org
    • Triggering command: /usr/bin/dotnet dotnet msbuild src/NuGet.Core/NuGet.Protocol/NuGet.Protocol.csproj -v:q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Nigusu-Allehu
Nigusu-Allehu force-pushed the dev-nyenework-stj-metadata-field-converter branch from e346b27 to d5150f2 Compare May 5, 2026 23:57
@Nigusu-Allehu

Copy link
Copy Markdown
Member Author

merge conflict resolution with copilot got a bit messy but fixed manually now.

@Nigusu-Allehu
Nigusu-Allehu requested a review from jeffkl May 6, 2026 00:19
@Nigusu-Allehu
Nigusu-Allehu force-pushed the dev-nyenework-stj-metadata-field-converter branch from 9ddcc35 to ce4385a Compare May 6, 2026 15:13
@Nigusu-Allehu
Nigusu-Allehu force-pushed the dev-nyenework-stj-metadata-field-converter branch from ce4385a to e129389 Compare May 6, 2026 15:20
@Nigusu-Allehu

Copy link
Copy Markdown
Member Author

I needed a rebase to fix CI. Squashed (to avoid multiple merge conflicts) and rebased.

@Nigusu-Allehu
Nigusu-Allehu enabled auto-merge (squash) May 6, 2026 15:25
@Nigusu-Allehu
Nigusu-Allehu disabled auto-merge May 6, 2026 15:32
@Nigusu-Allehu
Nigusu-Allehu merged commit 22eb028 into dev May 6, 2026
17 of 18 checks passed
@Nigusu-Allehu
Nigusu-Allehu deleted the dev-nyenework-stj-metadata-field-converter branch May 6, 2026 22:22
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.

Add System.Text.Json equivalent of MetadataFieldConverter

5 participants