From 91f6e0479891e4e73644dc4a66ad001ce30a0f7a Mon Sep 17 00:00:00 2001 From: Ben McCallum Date: Fri, 13 Aug 2021 17:52:50 +0200 Subject: [PATCH] Add preview for HCv12 (#58) --- src/Directory.Build.props | 4 +- ...throwIfNoValidatorsFound=True.verified.txt | 105 ++++++++++++++++++ .../ValidationMiddlewareInjector.cs | 4 +- 3 files changed, 110 insertions(+), 3 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e3a12ad..e79af36 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -17,9 +17,9 @@ https://github.com/benmccallum/fairybread/raw/master/logo-400x400.png https://github.com/benmccallum/fairybread/blob/master/LICENSE - 7.0.0 + 8.0.0-preview.1 - 11.0.9 + 12.0.0-preview.29 net5.0; netcoreapp3.1; netstandard2.0 net5.0; netcoreapp3.1; netcoreapp2.1 diff --git a/src/FairyBread.Tests/ValidationMiddlewareTests.Should_Respect_ThrowIfNoValidatorsFound_Option_throwIfNoValidatorsFound=True.verified.txt b/src/FairyBread.Tests/ValidationMiddlewareTests.Should_Respect_ThrowIfNoValidatorsFound_Option_throwIfNoValidatorsFound=True.verified.txt index 665a4d2..9a37769 100644 --- a/src/FairyBread.Tests/ValidationMiddlewareTests.Should_Respect_ThrowIfNoValidatorsFound_Option_throwIfNoValidatorsFound=True.verified.txt +++ b/src/FairyBread.Tests/ValidationMiddlewareTests.Should_Respect_ThrowIfNoValidatorsFound_Option_throwIfNoValidatorsFound=True.verified.txt @@ -15,6 +15,111 @@ $type: Exception, Type: Exception, Message: No validators were found by FairyBread. Ensure you're registering your FluentValidation validators for DI. + }, + SyntaxNode: { + Kind: Field, + Arguments: [ + { + Kind: Argument, + Location: { + Start: 13, + End: 59, + Line: 1, + Column: 14 + }, + Name: { + Location: { + Start: 13, + End: 17, + Line: 1, + Column: 14 + }, + Value: foo + }, + Value: { + Kind: ObjectValue, + Location: { + Start: 18, + End: 59, + Line: 1, + Column: 19 + }, + Fields: [ + { + Kind: ObjectField, + Location: { + Start: 20, + End: 47, + Line: 1, + Column: 21 + }, + Name: { + Location: { + Start: 20, + End: 32, + Line: 1, + Column: 21 + }, + Value: someInteger + }, + Value: { + Kind: IntValue, + Location: { + Start: 33, + End: 47, + Line: 1, + Column: 34 + }, + Value: -1 + } + }, + { + Kind: ObjectField, + Location: { + Start: 37, + End: 58, + Line: 1, + Column: 38 + }, + Name: { + Location: { + Start: 37, + End: 48, + Line: 1, + Column: 38 + }, + Value: someString + }, + Value: { + Kind: StringValue, + Location: { + Start: 49, + End: 58, + Line: 1, + Column: 50 + }, + Value: hello + } + } + ] + } + } + ], + Location: { + Start: 8, + End: 61, + Line: 1, + Column: 9 + }, + Name: { + Location: { + Start: 8, + End: 13, + Line: 1, + Column: 9 + }, + Value: read + } } } ] diff --git a/src/FairyBread/ValidationMiddlewareInjector.cs b/src/FairyBread/ValidationMiddlewareInjector.cs index dfa9eff..f365936 100644 --- a/src/FairyBread/ValidationMiddlewareInjector.cs +++ b/src/FairyBread/ValidationMiddlewareInjector.cs @@ -44,7 +44,9 @@ public override void OnBeforeCompleteType( .Create(); } - fieldDef.MiddlewareComponents.Insert(0, _validationFieldMiddleware); + fieldDef.MiddlewareDefinitions.Insert( + 0, + new FieldMiddlewareDefinition(_validationFieldMiddleware)); } } }