This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecation information to the catalog if provided (#522)
- Loading branch information
Scott Bommarito
authored
May 17, 2019
1 parent
432ca5e
commit 0c09757
Showing
23 changed files
with
392 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace NuGet.Services.Metadata.Catalog | ||
{ | ||
public class PackageDeprecationItem | ||
{ | ||
/// <param name="reasons">The list of reasons a package was deprecated.</param> | ||
/// <param name="message">An additional message associated with a package, if one exists.</param> | ||
/// <param name="alternatePackageId"> | ||
/// The ID of a package that can be used alternatively. Must be specified if <paramref name="alternatePackageRange"/> is specified. | ||
/// </param> | ||
/// <param name="alternatePackageRange"> | ||
/// A string representing the version range of a package that can be used alternatively. Must be specified if <paramref name="alternatePackageId"/> is specified. | ||
/// </param> | ||
public PackageDeprecationItem( | ||
IReadOnlyList<string> reasons, | ||
string message, | ||
string alternatePackageId, | ||
string alternatePackageRange) | ||
{ | ||
if (reasons == null) | ||
{ | ||
throw new ArgumentNullException(nameof(reasons)); | ||
} | ||
|
||
if (!reasons.Any()) | ||
{ | ||
throw new ArgumentException(nameof(reasons)); | ||
} | ||
|
||
Reasons = reasons; | ||
Message = message; | ||
AlternatePackageId = alternatePackageId; | ||
AlternatePackageRange = alternatePackageRange; | ||
|
||
if (AlternatePackageId == null && AlternatePackageRange != null) | ||
{ | ||
throw new ArgumentException( | ||
"Cannot specify an alternate package version range if an alternate package ID is not provided.", | ||
nameof(AlternatePackageRange)); | ||
} | ||
|
||
if (AlternatePackageId != null && AlternatePackageRange == null) | ||
{ | ||
throw new ArgumentException( | ||
"Cannot specify an alternate package ID if an alternate package version range is not provided.", | ||
nameof(AlternatePackageId)); | ||
} | ||
} | ||
|
||
public IReadOnlyList<string> Reasons { get; } | ||
public string Message { get; } | ||
public string AlternatePackageId { get; } | ||
public string AlternatePackageRange { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.