mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
Revert "[SM-1197] - Duplicate GUIDS Show a more detailed error message if dup…" (#4190)
This reverts commit 43b34c433c
.
This commit is contained in:
@ -1,22 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Api.SecretsManager.Models.Request;
|
||||
|
||||
public class GetSecretsRequestModel : IValidatableObject
|
||||
public class GetSecretsRequestModel
|
||||
{
|
||||
[Required]
|
||||
public IEnumerable<Guid> Ids { get; set; }
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
var isDistinct = Ids.Distinct().Count() == Ids.Count();
|
||||
if (!isDistinct)
|
||||
{
|
||||
var duplicateGuids = Ids.GroupBy(x => x)
|
||||
.Where(g => g.Count() > 1)
|
||||
.Select(g => g.Key);
|
||||
|
||||
yield return new ValidationResult(
|
||||
$"The following GUIDs were duplicated {string.Join(", ", duplicateGuids)} ",
|
||||
new[] { nameof(GetSecretsRequestModel) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user