Skip to content

Commit

Permalink
feat: lower dependencies versions
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Apr 19, 2023
1 parent 9b80f1e commit 456b2da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
15 changes: 3 additions & 12 deletions src/Sitko.FluentValidation/Graph/FluentGraphValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Sitko.FluentValidation.Graph;

public partial class FluentGraphValidator : IFluentGraphValidator
public class FluentGraphValidator : IFluentGraphValidator
{
private static readonly ConcurrentDictionary<Type, Type?> TypesValidators = new();
private readonly ILogger<FluentGraphValidator> logger;
Expand Down Expand Up @@ -50,10 +50,7 @@ private ValidationContext<object> CreateValidationContext(object model, Validati
validatorSelector ??= ValidatorOptions.Global.ValidatorSelectors.DefaultValidatorSelectorFactory();

var context = parent?.CloneForChildValidator(model, true, validatorSelector) ??
new ValidationContext<object>(model, new PropertyChain(), validatorSelector)
{
RootContextData = { ["_FV_ServiceProvider"] = serviceScope.ServiceProvider }
};
new ValidationContext<object>(model, new PropertyChain(), validatorSelector) { RootContextData = { ["_FV_ServiceProvider"] = serviceScope.ServiceProvider } };

return context;
}
Expand All @@ -76,7 +73,7 @@ private ValidationContext<object> CreateValidationContext(object model, Validati
var validator = serviceScope.ServiceProvider.GetService(formValidatorType) as IValidator;
if (validator is null)
{
ValidatorIsNotRegistered(logger, model.GetType().FullName!);
logger.LogWarning("FluentValidation.IValidator<{ModelType}> is not registered in the application service provider", model.GetType().FullName);
TypesValidators[model.GetType()] = null;
}
else
Expand All @@ -87,12 +84,6 @@ private ValidationContext<object> CreateValidationContext(object model, Validati
return validator;
}

[LoggerMessage(
EventId = 0,
Level = LogLevel.Warning,
Message = "FluentValidation.IValidator<{ModelType}> is not registered in the application service provider")]
public static partial void ValidatorIsNotRegistered(ILogger logger, string modelType);

private async Task<ModelsValidationResult> TryValidateFieldAsync(
ModelFieldGraphValidationContext fieldGraphValidationContext,
ModelsValidationResult? result,
Expand Down
6 changes: 3 additions & 3 deletions src/Sitko.FluentValidation/Sitko.FluentValidation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.0.0"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>

Expand Down

0 comments on commit 456b2da

Please sign in to comment.