Repository navigation
Protocol loads Owners from package sources as an enumerable type - #5605
Conversation
904a753 to
f3c260e
Compare
f3c260e to
8560654
Compare
nkolev92
left a comment
There was a problem hiding this comment.
Please get reviews from others, but this looks just fine to me.
8560654 to
2444cdc
Compare
This reverts commit 2444cdc.
|
This PR is blocked since Andy has feedback and appears to be unavailable for some time. My best understanding at present is that the feedback is around potential and ongoing confusion of what "Owners" means:
I agree that NuGet's 3 meanings of "Owners" is not intuitive. Perhaps someone can suggest an alternative name that they'd approve? |
|
Chatted offline with Andy. Going to investigate V2 private Hosted Feeds and their behavior with Owners. |
46d7c2c to
496f019
Compare
|
I wasn't able to see Owners coming through a NuGet.Server using V2 protocol. However, I'm now exposing OwnersList for V2 metadata as a preventative / forward-compatible approach. Local metadata is also now populating the OwnersList from the serialized Owners, so to reduce any confusion by SDK consumers. |
| if (_ownersList is null) | ||
| { | ||
| _ownersList = Owners != null ? Owners.Split(',').Select(s => s.Trim()).ToList() : null; | ||
| _ownersList = Owners != null ? Owners.Split(',').Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => s.Trim()).ToList() : null; |
There was a problem hiding this comment.
You can have string.Split not generate the emprty elements in the first place: https://learn.microsoft.com/en-us/dotnet/api/system.string.split?view=net-8.0#system-string-split(system-char()-system-stringsplitoptions)
edit: string.split's option probably wouldn't work for the test you have, since it's not empty, just whitespace, so your code is needed to make that test pass
Bug
Fixes: NuGet/Home#13186
Regression? Last working version:
Description
Read Owners collection from package sources into an enumerable type, rather than converting it to a comma-delimited string immediately upon parsing the JSON response.
There's no effective customer change in this PR, just that the enumeration is retained in Protocol types rather than only as a concatenated string. In subsequent PRs, I'll utilize this enumeration of owners for customer benefit.
Test changes:
EntityFrameworkSearch.json(from stale 2017 data) with latest package search metadata result response from nuget.org.test/NuGet.Core.Tests/NuGet.CommandLine.Xplat.Tests/PackageSearchRunnerTests.cswhich was failing as it attempted to assert that the Table Output contained owners. The registration JSON does not normally contain Owner, so I updated the JSON and the test accordingly.PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Documentation