init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.Domain;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Ellenorzo.Domain.VN.Interfaces;
|
||||
using Kreta.Ellenorzo.Dto.VN.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
|
||||
{
|
||||
/// <summary>
|
||||
/// Author: DevKornél Created On: 2019.05.
|
||||
/// </summary>
|
||||
public class ValidaciosHibaExample<TModel, TSameModel> : EllenorzoExceptionResponseDto, IExamplesProvider where TModel : class, IModelValidacio<TSameModel>, new() where TSameModel : class
|
||||
{
|
||||
public ValidaciosHibaExample() : base(BlExceptionType.ModelValidacio, BlExceptionType.ModelValidacio.ToDisplayName())
|
||||
{
|
||||
}
|
||||
|
||||
public ValidaciosHibaExample(IEnumerable<DetailedErrorItem> errorList)
|
||||
: base(BlExceptionType.ModelValidacio, BlExceptionType.ModelValidacio.ToDisplayName(), errorList.ToList())
|
||||
{
|
||||
}
|
||||
|
||||
public object GetExamples()
|
||||
{
|
||||
List<DetailedErrorItem> example = new List<DetailedErrorItem>();
|
||||
int index = 0;
|
||||
|
||||
new List<string>(new TModel().ModelValidaciok.Values).ForEach(x => example.Add(new DetailedErrorItem($"custom_{++index}", x, BlExceptionType.ModelValidacio)));
|
||||
|
||||
return new ValidaciosHibaExample<TModel, TSameModel>(example);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user