Skip to content

Commit 3beb489

Browse files
Use spaces (#58)
1 parent a47bad1 commit 3beb489

94 files changed

Lines changed: 5389 additions & 5377 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ charset = utf-8
55
insert_final_newline = true
66
trim_trailing_whitespace = true
77

8-
[*.cs]
9-
indent_style = tab
10-
tab_width = 2
8+
[*.{cs,csproj}]
9+
indent_style = space
10+
indent_size = 2
1111

12-
[*.yaml]
12+
[*.{yaml,json}]
1313
indent_style = space
1414
indent_size = 2
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Nullable>enable</Nullable>
6-
<Version>0.2.1</Version>
7-
<LangVersion>9</LangVersion>
8-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
9-
<IncludeSymbols>true</IncludeSymbols>
10-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
11-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
12-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<Version>0.2.1</Version>
7+
<LangVersion>9</LangVersion>
8+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
9+
<IncludeSymbols>true</IncludeSymbols>
10+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
11+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
12+
</PropertyGroup>
1313

14-
<PropertyGroup>
15-
<RepositoryType>git</RepositoryType>
16-
<RepositoryUrl>https://github.com/appany/AppAny.HotChocolate.FluentValidation</RepositoryUrl>
17-
<PackageProjectUrl>https://github.com/appany/AppAny.HotChocolate.FluentValidation</PackageProjectUrl>
18-
<PackageIcon>logo.png</PackageIcon>
19-
<PackageLicenseFile>LICENSE</PackageLicenseFile>
20-
<Copyright>Copyright ©2021 AppAny</Copyright>
21-
<Authors>sergeyshaykhullin</Authors>
22-
<Description>HotChocolate GraphQL FluentValidation integration</Description>
23-
<PackageTags>.NET Core;ASP.NET Core;HotChocolate;FluentValidation</PackageTags>
24-
</PropertyGroup>
14+
<PropertyGroup>
15+
<RepositoryType>git</RepositoryType>
16+
<RepositoryUrl>https://github.com/appany/AppAny.HotChocolate.FluentValidation</RepositoryUrl>
17+
<PackageProjectUrl>https://github.com/appany/AppAny.HotChocolate.FluentValidation</PackageProjectUrl>
18+
<PackageIcon>logo.png</PackageIcon>
19+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
20+
<Copyright>Copyright ©2021 AppAny</Copyright>
21+
<Authors>sergeyshaykhullin</Authors>
22+
<Description>HotChocolate GraphQL FluentValidation integration</Description>
23+
<PackageTags>.NET Core;ASP.NET Core;HotChocolate;FluentValidation</PackageTags>
24+
</PropertyGroup>
2525

26-
<ItemGroup Label="Packages">
27-
<PackageReference Include="FluentValidation" Version="10.0.0-preview4" />
28-
<PackageReference Include="HotChocolate.Execution" Version="11.1.0-preview.86" />
29-
</ItemGroup>
26+
<ItemGroup Label="Packages">
27+
<PackageReference Include="FluentValidation" Version="10.0.0-preview4" />
28+
<PackageReference Include="HotChocolate.Execution" Version="11.1.0-rc.4" />
29+
</ItemGroup>
3030

31-
<ItemGroup Label="Assets">
32-
<None Include="../assets/logo.png">
33-
<Pack>true</Pack>
34-
<Visible>false</Visible>
35-
<PackagePath />
36-
</None>
37-
<None Include="../LICENSE">
38-
<Pack>true</Pack>
39-
<Visible>false</Visible>
40-
<PackagePath />
41-
</None>
42-
</ItemGroup>
31+
<ItemGroup Label="Assets">
32+
<None Include="../assets/logo.png">
33+
<Pack>true</Pack>
34+
<Visible>false</Visible>
35+
<PackagePath />
36+
</None>
37+
<None Include="../LICENSE">
38+
<Pack>true</Pack>
39+
<Visible>false</Visible>
40+
<PackagePath />
41+
</None>
42+
</ItemGroup>
4343

4444
</Project>

src/Attributes/BaseUseValidatorAttribute.cs

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,54 @@
33

44
namespace AppAny.HotChocolate.FluentValidation
55
{
6-
public abstract class BaseUseValidatorAttribute : FluentValidationAttribute
7-
{
8-
protected BaseUseValidatorAttribute(Type validatorType)
9-
{
10-
ValidatorType = validatorType;
11-
}
12-
13-
public Type ValidatorType { get; }
14-
15-
public string[]? IncludeProperties { get; set; }
16-
public string[]? IncludeRuleSets { get; set; }
17-
public bool IncludeAllRuleSets { get; set; }
18-
public bool IncludeRulesNotInRuleSet { get; set; }
19-
20-
protected Action<ValidationStrategy<object>>? TryGetValidationStrategy()
21-
{
22-
var shouldUseValidationStrategy = IncludeProperties is not null
23-
|| IncludeRuleSets is not null
24-
|| IncludeAllRuleSets
25-
|| IncludeRulesNotInRuleSet;
26-
27-
if (shouldUseValidationStrategy)
28-
{
29-
return strategy =>
30-
{
31-
if (IncludeProperties is not null)
32-
{
33-
strategy.IncludeProperties(IncludeProperties);
34-
}
35-
36-
if (IncludeRuleSets is not null)
37-
{
38-
strategy.IncludeRuleSets(IncludeRuleSets);
39-
}
40-
41-
if (IncludeAllRuleSets)
42-
{
43-
strategy.IncludeAllRuleSets();
44-
}
45-
46-
if (IncludeRulesNotInRuleSet)
47-
{
48-
strategy.IncludeRulesNotInRuleSet();
49-
}
50-
};
51-
}
52-
53-
return null;
54-
}
55-
}
6+
public abstract class BaseUseValidatorAttribute : FluentValidationAttribute
7+
{
8+
protected BaseUseValidatorAttribute(Type validatorType)
9+
{
10+
ValidatorType = validatorType;
11+
}
12+
13+
public Type ValidatorType { get; }
14+
15+
public string[]? IncludeProperties { get; set; }
16+
public string[]? IncludeRuleSets { get; set; }
17+
public bool IncludeAllRuleSets { get; set; }
18+
public bool IncludeRulesNotInRuleSet { get; set; }
19+
20+
protected Action<ValidationStrategy<object>>? TryGetValidationStrategy()
21+
{
22+
var shouldUseValidationStrategy = IncludeProperties is not null
23+
|| IncludeRuleSets is not null
24+
|| IncludeAllRuleSets
25+
|| IncludeRulesNotInRuleSet;
26+
27+
if (shouldUseValidationStrategy)
28+
{
29+
return strategy =>
30+
{
31+
if (IncludeProperties is not null)
32+
{
33+
strategy.IncludeProperties(IncludeProperties);
34+
}
35+
36+
if (IncludeRuleSets is not null)
37+
{
38+
strategy.IncludeRuleSets(IncludeRuleSets);
39+
}
40+
41+
if (IncludeAllRuleSets)
42+
{
43+
strategy.IncludeAllRuleSets();
44+
}
45+
46+
if (IncludeRulesNotInRuleSet)
47+
{
48+
strategy.IncludeRulesNotInRuleSet();
49+
}
50+
};
51+
}
52+
53+
return null;
54+
}
55+
}
5656
}

src/Attributes/FluentValidationAttribute.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace AppAny.HotChocolate.FluentValidation
44
{
5-
public abstract class FluentValidationAttribute : Attribute
6-
{
7-
public abstract void Configure(ArgumentValidationBuilder builder);
8-
}
5+
public abstract class FluentValidationAttribute : Attribute
6+
{
7+
public abstract void Configure(ArgumentValidationBuilder builder);
8+
}
99
}

src/Attributes/SkipValidationAttribute.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace AppAny.HotChocolate.FluentValidation
44
{
5-
public class SkipValidationAttribute : FluentValidationAttribute
6-
{
7-
public sealed override void Configure(ArgumentValidationBuilder builder)
8-
{
9-
builder.SkipValidation(SkipValidation);
10-
}
5+
public class SkipValidationAttribute : FluentValidationAttribute
6+
{
7+
public sealed override void Configure(ArgumentValidationBuilder builder)
8+
{
9+
builder.SkipValidation(SkipValidation);
10+
}
1111

12-
protected virtual ValueTask<bool> SkipValidation(SkipValidationContext skipValidationContext)
13-
{
14-
return ValidationDefaults.SkipValidation.Skip(skipValidationContext);
15-
}
16-
}
12+
protected virtual ValueTask<bool> SkipValidation(SkipValidationContext skipValidationContext)
13+
{
14+
return ValidationDefaults.SkipValidation.Skip(skipValidationContext);
15+
}
16+
}
1717
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namespace AppAny.HotChocolate.FluentValidation
22
{
3-
public sealed class UseDefaultErrorMapperAttribute : FluentValidationAttribute
4-
{
5-
public override void Configure(ArgumentValidationBuilder builder)
6-
{
7-
builder.UseDefaultErrorMapper();
8-
}
9-
}
3+
public sealed class UseDefaultErrorMapperAttribute : FluentValidationAttribute
4+
{
5+
public override void Configure(ArgumentValidationBuilder builder)
6+
{
7+
builder.UseDefaultErrorMapper();
8+
}
9+
}
1010
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namespace AppAny.HotChocolate.FluentValidation
22
{
3-
public sealed class UseDefaultErrorMapperWithDetailsAttribute : FluentValidationAttribute
4-
{
5-
public override void Configure(ArgumentValidationBuilder builder)
6-
{
7-
builder.UseDefaultErrorMapperWithDetails();
8-
}
9-
}
3+
public sealed class UseDefaultErrorMapperWithDetailsAttribute : FluentValidationAttribute
4+
{
5+
public override void Configure(ArgumentValidationBuilder builder)
6+
{
7+
builder.UseDefaultErrorMapperWithDetails();
8+
}
9+
}
1010
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namespace AppAny.HotChocolate.FluentValidation
22
{
3-
public sealed class UseDefaultErrorMapperWithExtendedDetailsAttribute : FluentValidationAttribute
4-
{
5-
public override void Configure(ArgumentValidationBuilder builder)
6-
{
7-
builder.UseDefaultErrorMapperWithExtendedDetails();
8-
}
9-
}
3+
public sealed class UseDefaultErrorMapperWithExtendedDetailsAttribute : FluentValidationAttribute
4+
{
5+
public override void Configure(ArgumentValidationBuilder builder)
6+
{
7+
builder.UseDefaultErrorMapperWithExtendedDetails();
8+
}
9+
}
1010
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namespace AppAny.HotChocolate.FluentValidation
22
{
3-
public sealed class UseDefaultInputValidatorAttribute : FluentValidationAttribute
4-
{
5-
public override void Configure(ArgumentValidationBuilder builder)
6-
{
7-
builder.UseDefaultInputValidator();
8-
}
9-
}
3+
public sealed class UseDefaultInputValidatorAttribute : FluentValidationAttribute
4+
{
5+
public override void Configure(ArgumentValidationBuilder builder)
6+
{
7+
builder.UseDefaultInputValidator();
8+
}
9+
}
1010
}

src/Attributes/UseFluentValidationAttribute.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55

66
namespace AppAny.HotChocolate.FluentValidation
77
{
8-
/// <summary>
9-
/// Use default validation options.
10-
/// To override options use Code-first approach <see cref="ArgumentDescriptorExtensions"/>
11-
/// </summary>
12-
[AttributeUsage(AttributeTargets.Parameter)]
13-
public sealed class UseFluentValidationAttribute : ArgumentDescriptorAttribute
14-
{
15-
public override void OnConfigure(
16-
IDescriptorContext context,
17-
IArgumentDescriptor descriptor,
18-
ParameterInfo parameter)
19-
{
20-
var fluentValidationAttributes = parameter.GetCustomAttributes<FluentValidationAttribute>();
8+
/// <summary>
9+
/// Use default validation options.
10+
/// To override options use Code-first approach <see cref="ArgumentDescriptorExtensions"/>
11+
/// </summary>
12+
[AttributeUsage(AttributeTargets.Parameter)]
13+
public sealed class UseFluentValidationAttribute : ArgumentDescriptorAttribute
14+
{
15+
public override void OnConfigure(
16+
IDescriptorContext context,
17+
IArgumentDescriptor descriptor,
18+
ParameterInfo parameter)
19+
{
20+
var fluentValidationAttributes = parameter.GetCustomAttributes<FluentValidationAttribute>();
2121

22-
descriptor.UseFluentValidation(options =>
23-
{
24-
foreach (var fluentValidationAttribute in fluentValidationAttributes)
25-
{
26-
fluentValidationAttribute.Configure(options);
27-
}
28-
});
29-
}
30-
}
22+
descriptor.UseFluentValidation(options =>
23+
{
24+
foreach (var fluentValidationAttribute in fluentValidationAttributes)
25+
{
26+
fluentValidationAttribute.Configure(options);
27+
}
28+
});
29+
}
30+
}
3131
}

0 commit comments

Comments
 (0)