Skip to content

Commit 7ada49a

Browse files
authored
Update HotChocolate to 13.0.0-preview.95 (#105)
1 parent ff0b717 commit 7ada49a

8 files changed

Lines changed: 24 additions & 33 deletions

src/AppAny.HotChocolate.FluentValidation.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
<ItemGroup Label="Packages">
3636
<PackageReference Include="FluentValidation" Version="11.1.1" />
37-
<PackageReference Include="HotChocolate.Execution" Version="13.0.0-preview.66" />
37+
<PackageReference Include="HotChocolate.Execution" Version="13.0.0-preview.95" />
3838
</ItemGroup>
3939

4040
<ItemGroup Label="Assets">

src/Extensions/RequestExecutorBuilderExtensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public static IRequestExecutorBuilder AddFluentValidation(
1818

1919
builder.SetContextData(ValidationDefaults.ValidationOptionsKey, validationOptions);
2020

21-
builder.OnBeforeCompleteType(ValidationDefaults.Interceptors.OnBeforeCompleteType);
22-
23-
builder.OnAfterSchemaCreate(ValidationDefaults.Interceptors.OnAfterSchemaCreate);
21+
builder.TryAddTypeInterceptor(ValidationDefaults.Interceptor);
2422

2523
return builder;
2624
}

src/ValidationDefaults.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
global using FluentValidation.Results;
88
using System.Runtime.CompilerServices;
99
using FluentValidation.Internal;
10-
using HotChocolate.Configuration;
1110
using Microsoft.Extensions.DependencyInjection;
1211

1312
namespace AppAny.HotChocolate.FluentValidation
@@ -35,13 +34,9 @@ public static class ValidationDefaults
3534
public static FieldMiddleware Middleware { get; } = ValidationMiddlewares.Field;
3635

3736
/// <summary>
38-
/// Default HotChocolate interceptors
37+
/// Default HotChocolate interceptor
3938
/// </summary>
40-
public static class Interceptors
41-
{
42-
public static OnCompleteType OnBeforeCompleteType { get; } = ValidationInterceptors.OnBeforeCompleteType;
43-
public static OnAfterSchemaCreate OnAfterSchemaCreate { get; } = ValidationInterceptors.OnAfterSchemaCreate;
44-
}
39+
public static Type Interceptor { get; } = typeof(ValidationInterceptor);
4540

4641
/// <summary>
4742
/// Default graphql error extensions keys
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
using System.Collections.Generic;
21
using System.Linq;
32
using HotChocolate.Configuration;
43
using HotChocolate.Types.Descriptors;
54
using HotChocolate.Types.Descriptors.Definitions;
65

76
namespace AppAny.HotChocolate.FluentValidation
87
{
9-
internal sealed class ValidationInterceptors
8+
internal sealed class ValidationInterceptor : TypeInterceptor
109
{
11-
public static void OnBeforeCompleteType(
10+
public override void OnBeforeCompleteType(
1211
ITypeCompletionContext completionContext,
13-
DefinitionBase? definition,
14-
IDictionary<string, object?> contextData)
12+
DefinitionBase? definition)
1513
{
1614
if (definition is not ObjectTypeDefinition objectTypeDefinition)
1715
{
@@ -43,7 +41,7 @@ public static void OnBeforeCompleteType(
4341
}
4442
}
4543

46-
public static void OnAfterSchemaCreate(IDescriptorContext descriptorContext, ISchema schema)
44+
public override void OnAfterCreateSchema(IDescriptorContext descriptorContext, ISchema schema)
4745
{
4846
foreach (var objectField in schema.Types.OfType<IObjectType>().SelectMany(type => type.Fields))
4947
{

tests/AppAny.HotChocolate.FluentValidation.Benchmarks/EmptyInputsValidationBenchmarks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public async Task GlobalSetup()
2626
.Argument("input", arg => arg.Type<TestInputType>().UseFluentValidation())))
2727
.Services.AddSingleton<IValidator<TestInput>, TestInputValidator>());
2828

29-
fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30-
builder => builder.AddFairyBread()
31-
.AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32-
.Services.AddSingleton<TestInputValidator>().AddSingleton<IValidator<TestInput>, TestInputValidator>());
29+
// fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30+
// builder => builder.AddFairyBread()
31+
// .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32+
// .Services.AddSingleton<TestInputValidator>().AddSingleton<IValidator<TestInput>, TestInputValidator>());
3333
}
3434

3535
[Benchmark]

tests/AppAny.HotChocolate.FluentValidation.Benchmarks/NullInputsValidationBenchmarks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public async Task GlobalSetup()
2626
field.Argument("input", arg => arg.Type<TestInputType>().UseFluentValidation())))
2727
.Services.AddSingleton<IValidator<TestInput>, TestInputValidator>());
2828

29-
fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30-
builder => builder.AddFairyBread()
31-
.AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32-
.Services.AddSingleton<TestInputValidator>().AddSingleton<IValidator<TestInput>, TestInputValidator>());
29+
// fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30+
// builder => builder.AddFairyBread()
31+
// .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32+
// .Services.AddSingleton<TestInputValidator>().AddSingleton<IValidator<TestInput>, TestInputValidator>());
3333
}
3434

3535
[Benchmark]

tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ScopedValidationBenchmarks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public async Task GlobalSetup()
2626
.Type<TestInputType>().UseFluentValidation(opt => opt.UseValidator<TestInputValidator>()))))
2727
.Services.AddScoped<TestInputValidator>());
2828

29-
fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30-
builder => builder.AddFairyBread()
31-
.AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32-
.Services.AddScoped<TestInputValidator>().AddScoped<IValidator<TestInput>, TestInputValidator>());
29+
// fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30+
// builder => builder.AddFairyBread()
31+
// .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32+
// .Services.AddScoped<TestInputValidator>().AddScoped<IValidator<TestInput>, TestInputValidator>());
3333
}
3434

3535
[Benchmark]

tests/AppAny.HotChocolate.FluentValidation.Benchmarks/SingletonValidationBenchmarks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public async Task GlobalSetup()
2626
.Type<TestInputType>().UseFluentValidation(opt => opt.UseValidator<TestInputValidator>()))))
2727
.Services.AddSingleton<TestInputValidator>());
2828

29-
fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30-
builder => builder.AddFairyBread()
31-
.AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32-
.Services.AddSingleton<TestInputValidator>().AddSingleton<IValidator<TestInput>, TestInputValidator>());
29+
// fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor(
30+
// builder => builder.AddFairyBread()
31+
// .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type<TestInputType>())))
32+
// .Services.AddSingleton<TestInputValidator>().AddSingleton<IValidator<TestInput>, TestInputValidator>());
3333
}
3434

3535
[Benchmark]

0 commit comments

Comments
 (0)