Proposal to Surface Sponsorship Information in the CLI - #14992
Conversation
|
@dotnet-policy-service agree company="Microsoft" |
nkolev92
left a comment
There was a problem hiding this comment.
Looks pretty good to me.
Just final details to iron out during the meeting.
donnie-msft
left a comment
There was a problem hiding this comment.
Great progress! I know this doc has gotten edited with many iterations of feedback. I think it needs to be consolidated a bit and structured so that it highlights your key design ideas.
| A source that does not support sponsorships will have a separate message: | ||
|
|
||
| ```text | ||
| These sources do not provide sponsorship support: |
There was a problem hiding this comment.
I think this is fine. We could only show this for --verbosity detailed or something.
No strong opinion from me.
| { | ||
| "version": 1, | ||
| "parameters": "--sponsor --format json", | ||
| "problems": [ |
There was a problem hiding this comment.
For --vulnerable, we output a list of sources here. Perhaps we should do the same and then in the "projects" below we could only list sources which have sponsors? This would reduce noise in the output while still providing the list of sources we checked against.
(note, in this case the local package feed could be listed as an enabled source, but we wouldn't query it since it's local and therefore not able to provide Registration)
"sources": [
"https://data.nuget.org/v3/index.json",
"C:/Program Files (x86)/Microsoft SDKs/NuGetPackages/"
],
| "projects": [ | ||
| { | ||
| "path": "/path/to/Contoso.App.csproj", | ||
| "sources": [ |
There was a problem hiding this comment.
FYI, Mentioned above that we may want to only list sources here that support Sponsorship metadata in Registration.
| Sponsorship information is applied to the package ID rather than the version of a package, which is why packages are listed once per package ID. | ||
| When a package has multiple sponsorship links, the CLI will display the links in the order returned by nuget.org. | ||
|
|
||
| Both top-level and transitive packages will be included by default when using `--sponsor`. |
There was a problem hiding this comment.
We group by top level & transitive for --vulnerable.
I propose that we remove "sources" and replace it with topLevelPackages & transitivePackages.
This proposed grouping is now project->top/transitive -> source providing 1 or more sponsor -> packageId which has 1 or more sponsor.
{
"projects": [
{
"path": "/path/to/Contoso.App.csproj",
"topLevelPackages": [
{
"source": "https://api.example.org/v3/index.json",
"sponsorablePackages": [
{
"id": "Contoso.Tools",
"urls": [
"https://github.com/sponsors/contoso"
]
},
{
"id": "Contoso.Utility",
"urls": [
"https://github.com/sponsors/contoso"
]
}
]
},
{
"source": "https://www.myget.org/F/contoso/api/v3/index.json",
"sponsorablePackages": [
{
"id": "Contoso.Utility",
"urls": [
"https://buymeacoffee.com/contoso"
]
}
]
}
],
"transitivePackages": [
{
"source": "https://api.example.org/v3/index.json",
"sponsorablePackages": [
{
"id": "Contoso.Tools.OpenApi",
"urls": [
"https://github.com/sponsors/contoso"
]
}
]
}
]
}
]
}There was a problem hiding this comment.
If we assume most sources will accurately mirror the source of truth, then we could de-duplicate lists and I think that'll make the average size go down. Something like:
{
"packages": [
{
"package": "Contoso.Utility",
"sponsorUrls": [
{
"sources": [ "feed1", "feed2" ],
"urls": [ "https://whatever", "https://something" ]
}
}
]
}This way the only time that sponsorUrls is an array with length != 1 is when a source disagrees about the complete list. But it avoids duplicating the package name, and the URL list
| No sponsorship details were returned using the following package sources: | ||
| https://api.example.org/v3/index.json | ||
|
|
||
| Consider specifying another package source with `--source <SOURCE>`. |
There was a problem hiding this comment.
Sounds fine to me IFF package source mapping is disabled.
Should we go ahead and use nuget.org in the example?
| Consider specifying another package source with `--source <SOURCE>`. | |
| Consider specifying an additional package source that provides sponsorship metadata, for example: `--source https://api.nuget.org/v3/index.json`. |
| "parameters": "--sponsor --format json", | ||
| "projects": [ | ||
| { | ||
| "path": "/path/to/Contoso.App.csproj", |
There was a problem hiding this comment.
The text output didn't propose grouping by project, and I don't think the json should either. This is a format specific for sponsor, not a shared format. If we think it's useful for customers to know which projects a package is used by, when getting sponsorship info, I think adding a projects array to a package object makes more sense.
Rendered Spec