diff --git a/AspNetCore.slnx b/AspNetCore.slnx index 78284eb90b2c..63083e4fceb9 100644 --- a/AspNetCore.slnx +++ b/AspNetCore.slnx @@ -6,95 +6,95 @@ - + - + - + - - + + - + - - + + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -106,31 +106,31 @@ - + - - + + - + - + - - + + - + - + @@ -141,102 +141,102 @@ - + - + - + - - + + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - - + + @@ -244,171 +244,170 @@ - - + + - + - + - - + + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - + - + - - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - - + + @@ -434,57 +433,57 @@ - - + + - + - + - - + + - + - + - + - + - + - + - + - + - + - + @@ -492,224 +491,224 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -736,120 +735,120 @@ - + - - + + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -859,29 +858,29 @@ - + - - + + - + - + - + - - + + @@ -921,7 +920,7 @@ - + @@ -931,7 +930,7 @@ - + @@ -940,7 +939,7 @@ - + @@ -949,7 +948,7 @@ - + @@ -978,7 +977,7 @@ - + @@ -988,33 +987,33 @@ - + - + - + - - + + - + - + - + @@ -1024,84 +1023,84 @@ - + - + - + - + - + - - + + - + - - - - + + + + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + @@ -1109,71 +1108,82 @@ - - + + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + diff --git a/eng/Build.props b/eng/Build.props index dbaf0c170561..7217430d1090 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -198,6 +198,7 @@ $(RepoRoot)src\Extensions\**\*.csproj; $(RepoRoot)src\BuildAfterTargetingPack\*.csproj; $(RepoRoot)src\OpenApi\**\*.csproj; + $(RepoRoot)src\Validation\**\*.csproj; $(RepoRoot)eng\tools\HelixTestRunner\HelixTestRunner.csproj; " Exclude=" @@ -242,6 +243,7 @@ $(RepoRoot)src\Extensions\**\src\*.csproj; $(RepoRoot)src\BuildAfterTargetingPack\*.csproj; $(RepoRoot)src\OpenApi\**\src\*.csproj; + $(RepoRoot)src\Validation\**\src\*.csproj; " Exclude=" @(ProjectToBuild); diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index 58eb2c5d2d61..7f5da9b33350 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -47,8 +47,8 @@ - + @@ -117,8 +117,8 @@ - + @@ -149,13 +149,13 @@ + - @@ -170,5 +170,6 @@ + diff --git a/eng/SharedFramework.Local.props b/eng/SharedFramework.Local.props index 533709fb9bf4..6da36d432c6c 100644 --- a/eng/SharedFramework.Local.props +++ b/eng/SharedFramework.Local.props @@ -37,6 +37,7 @@ + @@ -56,8 +57,8 @@ - + @@ -99,8 +100,8 @@ - + diff --git a/eng/ShippingAssemblies.props b/eng/ShippingAssemblies.props index d410959a9c7c..a3842c5c9d27 100644 --- a/eng/ShippingAssemblies.props +++ b/eng/ShippingAssemblies.props @@ -33,8 +33,8 @@ - + @@ -77,8 +77,8 @@ - + @@ -105,6 +105,7 @@ + @@ -165,3 +166,4 @@ + diff --git a/eng/TrimmableProjects.props b/eng/TrimmableProjects.props index 199d65af1b49..1ffaf18a83bf 100644 --- a/eng/TrimmableProjects.props +++ b/eng/TrimmableProjects.props @@ -37,8 +37,8 @@ - + @@ -104,11 +104,11 @@ + - @@ -118,5 +118,6 @@ + diff --git a/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj b/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj index 44cd40b611d7..33d1bcd4d9c9 100644 --- a/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj +++ b/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj @@ -77,7 +77,7 @@ OutputItemType="AspNetCoreAnalyzer" ReferenceOutputAssembly="false" /> - diff --git a/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt b/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt index 8cb332fa9f20..3a2461306d54 100644 --- a/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt +++ b/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt @@ -1,44 +1,5 @@ #nullable enable -abstract Microsoft.AspNetCore.Http.Validation.ValidatableParameterInfo.GetValidationAttributes() -> System.ComponentModel.DataAnnotations.ValidationAttribute![]! -abstract Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo.GetValidationAttributes() -> System.ComponentModel.DataAnnotations.ValidationAttribute![]! Microsoft.AspNetCore.Http.Metadata.IDisableValidationMetadata Microsoft.AspNetCore.Http.ProducesResponseTypeMetadata.Description.get -> string? Microsoft.AspNetCore.Http.ProducesResponseTypeMetadata.Description.set -> void Microsoft.AspNetCore.Http.Metadata.IProducesResponseTypeMetadata.Description.get -> string? -Microsoft.AspNetCore.Http.Validation.IValidatableInfo -Microsoft.AspNetCore.Http.Validation.IValidatableInfo.ValidateAsync(object? value, Microsoft.AspNetCore.Http.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! -Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver -Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver.TryGetValidatableParameterInfo(System.Reflection.ParameterInfo! parameterInfo, out Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) -> bool -Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver.TryGetValidatableTypeInfo(System.Type! type, out Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) -> bool -Microsoft.AspNetCore.Http.Validation.ValidatableParameterInfo -Microsoft.AspNetCore.Http.Validation.ValidatableParameterInfo.ValidatableParameterInfo(System.Type! parameterType, string! name, string! displayName) -> void -Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo -Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo.ValidatablePropertyInfo(System.Type! declaringType, System.Type! propertyType, string! name, string! displayName) -> void -Microsoft.AspNetCore.Http.Validation.ValidatableTypeAttribute -Microsoft.AspNetCore.Http.Validation.ValidatableTypeAttribute.ValidatableTypeAttribute() -> void -Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo -Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo.ValidatableTypeInfo(System.Type! type, System.Collections.Generic.IReadOnlyList! members) -> void -Microsoft.AspNetCore.Http.Validation.ValidateContext -Microsoft.AspNetCore.Http.Validation.ValidateContext.CurrentDepth.get -> int -Microsoft.AspNetCore.Http.Validation.ValidateContext.CurrentDepth.set -> void -Microsoft.AspNetCore.Http.Validation.ValidateContext.CurrentValidationPath.get -> string! -Microsoft.AspNetCore.Http.Validation.ValidateContext.CurrentValidationPath.set -> void -Microsoft.AspNetCore.Http.Validation.ValidateContext.ValidateContext() -> void -Microsoft.AspNetCore.Http.Validation.ValidateContext.ValidationContext.get -> System.ComponentModel.DataAnnotations.ValidationContext! -Microsoft.AspNetCore.Http.Validation.ValidateContext.ValidationContext.set -> void -Microsoft.AspNetCore.Http.Validation.ValidateContext.ValidationErrors.get -> System.Collections.Generic.Dictionary? -Microsoft.AspNetCore.Http.Validation.ValidateContext.ValidationErrors.set -> void -Microsoft.AspNetCore.Http.Validation.ValidateContext.ValidationOptions.get -> Microsoft.AspNetCore.Http.Validation.ValidationOptions! -Microsoft.AspNetCore.Http.Validation.ValidateContext.ValidationOptions.set -> void -Microsoft.AspNetCore.Http.Validation.ValidationOptions -Microsoft.AspNetCore.Http.Validation.ValidationOptions.MaxDepth.get -> int -Microsoft.AspNetCore.Http.Validation.ValidationOptions.MaxDepth.set -> void -Microsoft.AspNetCore.Http.Validation.ValidationOptions.Resolvers.get -> System.Collections.Generic.IList! -Microsoft.AspNetCore.Http.Validation.ValidationOptions.TryGetValidatableParameterInfo(System.Reflection.ParameterInfo! parameterInfo, out Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) -> bool -Microsoft.AspNetCore.Http.Validation.ValidationOptions.TryGetValidatableTypeInfo(System.Type! type, out Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableTypeInfo) -> bool -Microsoft.AspNetCore.Http.Validation.ValidationOptions.ValidationOptions() -> void -Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions -static Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action? configureOptions = null) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -virtual Microsoft.AspNetCore.Http.Validation.ValidatableParameterInfo.ValidateAsync(object? value, Microsoft.AspNetCore.Http.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! -virtual Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo.ValidateAsync(object? value, Microsoft.AspNetCore.Http.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! -virtual Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo.ValidateAsync(object? value, Microsoft.AspNetCore.Http.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! diff --git a/src/Http/Http.Extensions/test/Microsoft.AspNetCore.Http.Extensions.Tests.csproj b/src/Http/Http.Extensions/test/Microsoft.AspNetCore.Http.Extensions.Tests.csproj index b45c15cbe792..1900e5ea3ebb 100644 --- a/src/Http/Http.Extensions/test/Microsoft.AspNetCore.Http.Extensions.Tests.csproj +++ b/src/Http/Http.Extensions/test/Microsoft.AspNetCore.Http.Extensions.Tests.csproj @@ -32,7 +32,6 @@ - @@ -45,6 +44,5 @@ - diff --git a/src/Http/Http/perf/Microbenchmarks/Microsoft.AspNetCore.Http.Microbenchmarks.csproj b/src/Http/Http/perf/Microbenchmarks/Microsoft.AspNetCore.Http.Microbenchmarks.csproj index 54d99f9254e5..663745c85991 100644 --- a/src/Http/Http/perf/Microbenchmarks/Microsoft.AspNetCore.Http.Microbenchmarks.csproj +++ b/src/Http/Http/perf/Microbenchmarks/Microsoft.AspNetCore.Http.Microbenchmarks.csproj @@ -19,6 +19,7 @@ + diff --git a/src/Http/Http/perf/Microbenchmarks/ValidatableTypesBenchmark.cs b/src/Http/Http/perf/Microbenchmarks/ValidatableTypesBenchmark.cs index 973d22ed0674..6af879569e80 100644 --- a/src/Http/Http/perf/Microbenchmarks/ValidatableTypesBenchmark.cs +++ b/src/Http/Http/perf/Microbenchmarks/ValidatableTypesBenchmark.cs @@ -7,9 +7,9 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using BenchmarkDotNet.Attributes; -using Microsoft.AspNetCore.Http.Validation; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Microsoft.Extensions.Validation; namespace Microsoft.AspNetCore.Http.Microbenchmarks; diff --git a/src/Http/HttpAbstractions.slnf b/src/Http/HttpAbstractions.slnf index 69a4e98a5599..265e3674aa4a 100644 --- a/src/Http/HttpAbstractions.slnf +++ b/src/Http/HttpAbstractions.slnf @@ -21,7 +21,6 @@ "src\\Http\\Http.Abstractions\\src\\Microsoft.AspNetCore.Http.Abstractions.csproj", "src\\Http\\Http.Abstractions\\test\\Microsoft.AspNetCore.Http.Abstractions.Tests.csproj", "src\\Http\\Http.Extensions\\gen\\Microsoft.AspNetCore.Http.RequestDelegateGenerator\\Microsoft.AspNetCore.Http.RequestDelegateGenerator.csproj", - "src\\Http\\Http.Extensions\\gen\\Microsoft.AspNetCore.Http.ValidationsGenerator\\Microsoft.AspNetCore.Http.ValidationsGenerator.csproj", "src\\Http\\Http.Extensions\\src\\Microsoft.AspNetCore.Http.Extensions.csproj", "src\\Http\\Http.Extensions\\test\\Microsoft.AspNetCore.Http.Extensions.Tests.csproj", "src\\Http\\Http.Features\\src\\Microsoft.AspNetCore.Http.Features.csproj", @@ -74,4 +73,4 @@ "src\\WebEncoders\\src\\Microsoft.Extensions.WebEncoders.csproj" ] } -} \ No newline at end of file +} diff --git a/src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj b/src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj index 16a710df5ce4..61036f37c6d3 100644 --- a/src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj +++ b/src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj @@ -51,6 +51,7 @@ + diff --git a/src/Http/Routing/src/RouteEndpointDataSource.cs b/src/Http/Routing/src/RouteEndpointDataSource.cs index cbdac85e3e8c..9586ceeff18f 100644 --- a/src/Http/Routing/src/RouteEndpointDataSource.cs +++ b/src/Http/Routing/src/RouteEndpointDataSource.cs @@ -14,6 +14,7 @@ using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; +using Microsoft.Extensions.Validation; namespace Microsoft.AspNetCore.Routing; diff --git a/src/Http/Routing/src/ValidationEndpointFilterFactory.cs b/src/Http/Routing/src/ValidationEndpointFilterFactory.cs index 73a41f0f8d57..f9e59bc88c12 100644 --- a/src/Http/Routing/src/ValidationEndpointFilterFactory.cs +++ b/src/Http/Routing/src/ValidationEndpointFilterFactory.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Http.Metadata; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Microsoft.Extensions.Validation; namespace Microsoft.AspNetCore.Http.Validation; diff --git a/src/Http/samples/MinimalValidationSample/MinimalValidationSample.csproj b/src/Http/samples/MinimalValidationSample/MinimalValidationSample.csproj index 24690f4dbd35..e01722e04559 100644 --- a/src/Http/samples/MinimalValidationSample/MinimalValidationSample.csproj +++ b/src/Http/samples/MinimalValidationSample/MinimalValidationSample.csproj @@ -4,7 +4,7 @@ $(DefaultNetCoreTargetFramework) enable true - $(InterceptorsNamespaces);Microsoft.AspNetCore.Http.Validation.Generated + $(InterceptorsNamespaces);Microsoft.Extensions.Validation.Generated @@ -14,12 +14,13 @@ + - diff --git a/src/Http/samples/MinimalValidationSample/Program.cs b/src/Http/samples/MinimalValidationSample/Program.cs index 9afcebfb2b02..266e2cf74c0a 100644 --- a/src/Http/samples/MinimalValidationSample/Program.cs +++ b/src/Http/samples/MinimalValidationSample/Program.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; var builder = WebApplication.CreateBuilder(args); diff --git a/src/Validation/Validation.slnf b/src/Validation/Validation.slnf new file mode 100644 index 000000000000..7f6b3ab900ae --- /dev/null +++ b/src/Validation/Validation.slnf @@ -0,0 +1,11 @@ +{ + "solution": { + "path": "..\\..\\AspNetCore.slnx", + "projects": [ + "src\\Validation\\src\\Microsoft.Extensions.Validation.csproj", + "src\\Validation\\test\\Microsoft.Extensions.Validation.Tests\\Microsoft.Extensions.Validation.Tests.csproj", + "src\\Validation\\gen\\Microsoft.Extensions.Validation.ValidationsGenerator.csproj", + "src\\Validation\\test\\Microsoft.Extensions.Validation.GeneratorTests\\Microsoft.Extensions.Validation.GeneratorTests.csproj" + ] + } +} diff --git a/src/Validation/build.cmd b/src/Validation/build.cmd new file mode 100644 index 000000000000..7be8285e8a42 --- /dev/null +++ b/src/Validation/build.cmd @@ -0,0 +1,4 @@ +@ECHO OFF +SET RepoRoot=%~dp0..\.. + +call %RepoRoot%\eng\build.cmd -projects %RepoRoot%\src\Validation\**\*.csproj %* \ No newline at end of file diff --git a/src/Validation/build.sh b/src/Validation/build.sh new file mode 100755 index 000000000000..2663e52d431d --- /dev/null +++ b/src/Validation/build.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -euo pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +"$DIR/../../eng/build.sh" --projects "$DIR/**/*.csproj" "$@" \ No newline at end of file diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Emitters/ValidationsGenerator.Emitter.cs b/src/Validation/gen/Emitters/ValidationsGenerator.Emitter.cs similarity index 94% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Emitters/ValidationsGenerator.Emitter.cs rename to src/Validation/gen/Emitters/ValidationsGenerator.Emitter.cs index 9ff704d8fcf2..8deb7be3a60e 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Emitters/ValidationsGenerator.Emitter.cs +++ b/src/Validation/gen/Emitters/ValidationsGenerator.Emitter.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.CSharp; using System.IO; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; public sealed partial class ValidationsGenerator : IIncrementalGenerator { @@ -51,10 +51,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { {{GeneratedCodeAttribute}} - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -76,7 +76,7 @@ public GeneratedValidatablePropertyInfo( } {{GeneratedCodeAttribute}} - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -85,9 +85,9 @@ public GeneratedValidatableTypeInfo( } {{GeneratedCodeAttribute}} - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; {{EmitTypeChecks(validatableTypes)}} @@ -95,7 +95,7 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; @@ -106,7 +106,7 @@ public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterIn file static class GeneratedServiceCollectionExtensions { {{addValidation.GetInterceptsLocationAttributeSyntax()}} - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/ISymbolExtensions.cs b/src/Validation/gen/Extensions/ISymbolExtensions.cs similarity index 95% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/ISymbolExtensions.cs rename to src/Validation/gen/Extensions/ISymbolExtensions.cs index 86eb4e50a43a..b1b0a35a7b03 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/ISymbolExtensions.cs +++ b/src/Validation/gen/Extensions/ISymbolExtensions.cs @@ -5,7 +5,7 @@ using System.Linq; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal static class ISymbolExtensions { diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/ITypeSymbolExtensions.cs b/src/Validation/gen/Extensions/ITypeSymbolExtensions.cs similarity index 99% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/ITypeSymbolExtensions.cs rename to src/Validation/gen/Extensions/ITypeSymbolExtensions.cs index 0cd85d9df756..37186fee8a8a 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/ITypeSymbolExtensions.cs +++ b/src/Validation/gen/Extensions/ITypeSymbolExtensions.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.App.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal static class ITypeSymbolExtensions { diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/IncrementalValuesProviderExtensions.cs b/src/Validation/gen/Extensions/IncrementalValuesProviderExtensions.cs similarity index 98% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/IncrementalValuesProviderExtensions.cs rename to src/Validation/gen/Extensions/IncrementalValuesProviderExtensions.cs index bfbbd9369b62..aea74a7ab19c 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Extensions/IncrementalValuesProviderExtensions.cs +++ b/src/Validation/gen/Extensions/IncrementalValuesProviderExtensions.cs @@ -6,7 +6,7 @@ using System.Linq; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal static class IncrementalValuesProviderExtensions { diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Microsoft.AspNetCore.Http.ValidationsGenerator.csproj b/src/Validation/gen/Microsoft.Extensions.Validation.ValidationsGenerator.csproj similarity index 85% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Microsoft.AspNetCore.Http.ValidationsGenerator.csproj rename to src/Validation/gen/Microsoft.Extensions.Validation.ValidationsGenerator.csproj index a55218bb4185..64488ca48463 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Microsoft.AspNetCore.Http.ValidationsGenerator.csproj +++ b/src/Validation/gen/Microsoft.Extensions.Validation.ValidationsGenerator.csproj @@ -16,7 +16,7 @@ - + @@ -26,10 +26,10 @@ - + diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/RequiredSymbols.cs b/src/Validation/gen/Models/RequiredSymbols.cs similarity index 93% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/RequiredSymbols.cs rename to src/Validation/gen/Models/RequiredSymbols.cs index ea16b1de1490..51f8c92ccf9e 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/RequiredSymbols.cs +++ b/src/Validation/gen/Models/RequiredSymbols.cs @@ -3,7 +3,7 @@ using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal sealed record class RequiredSymbols( INamedTypeSymbol DisplayAttribute, diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableProperty.cs b/src/Validation/gen/Models/ValidatableProperty.cs similarity index 87% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableProperty.cs rename to src/Validation/gen/Models/ValidatableProperty.cs index 658f27a82e6b..22b960babcad 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableProperty.cs +++ b/src/Validation/gen/Models/ValidatableProperty.cs @@ -4,7 +4,7 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal sealed record class ValidatableProperty( ITypeSymbol ContainingType, diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableType.cs b/src/Validation/gen/Models/ValidatableType.cs similarity index 84% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableType.cs rename to src/Validation/gen/Models/ValidatableType.cs index c6d7e36f36a9..06f3df3b6234 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableType.cs +++ b/src/Validation/gen/Models/ValidatableType.cs @@ -4,7 +4,7 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal sealed record class ValidatableType( ITypeSymbol Type, diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableTypeComparer.cs b/src/Validation/gen/Models/ValidatableTypeComparer.cs similarity index 93% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableTypeComparer.cs rename to src/Validation/gen/Models/ValidatableTypeComparer.cs index fcd99f51dc0b..56f96a32e47c 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidatableTypeComparer.cs +++ b/src/Validation/gen/Models/ValidatableTypeComparer.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal sealed class ValidatableTypeComparer : IEqualityComparer { diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidationAttribute.cs b/src/Validation/gen/Models/ValidationAttribute.cs similarity index 86% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidationAttribute.cs rename to src/Validation/gen/Models/ValidationAttribute.cs index c29e12a99c0d..3558f9fcf6c5 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Models/ValidationAttribute.cs +++ b/src/Validation/gen/Models/ValidationAttribute.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; internal sealed record class ValidationAttribute( string Name, diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.AddValidation.cs b/src/Validation/gen/Parsers/ValidationsGenerator.AddValidation.cs similarity index 94% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.AddValidation.cs rename to src/Validation/gen/Parsers/ValidationsGenerator.AddValidation.cs index 1cb8061204ee..23f0d30b0ec7 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.AddValidation.cs +++ b/src/Validation/gen/Parsers/ValidationsGenerator.AddValidation.cs @@ -7,7 +7,7 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; public sealed partial class ValidationsGenerator : IIncrementalGenerator { @@ -29,7 +29,7 @@ internal bool FindAddValidation(SyntaxNode syntaxNode, CancellationToken cancell var symbol = semanticModel.GetSymbolInfo(node, cancellationToken).Symbol; if (symbol is not IMethodSymbol methodSymbol || methodSymbol.ContainingType.Name != "ValidationServiceCollectionExtensions" - || methodSymbol.ContainingAssembly.Name != "Microsoft.AspNetCore.Http.Abstractions") + || methodSymbol.ContainingAssembly.Name != "Microsoft.Extensions.Validation") { return null; } diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.AttributeParser.cs b/src/Validation/gen/Parsers/ValidationsGenerator.AttributeParser.cs similarity index 95% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.AttributeParser.cs rename to src/Validation/gen/Parsers/ValidationsGenerator.AttributeParser.cs index 3ba763b1b342..75566314d21b 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.AttributeParser.cs +++ b/src/Validation/gen/Parsers/ValidationsGenerator.AttributeParser.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; public sealed partial class ValidationsGenerator : IIncrementalGenerator { diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.EndpointsParser.cs b/src/Validation/gen/Parsers/ValidationsGenerator.EndpointsParser.cs similarity index 97% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.EndpointsParser.cs rename to src/Validation/gen/Parsers/ValidationsGenerator.EndpointsParser.cs index 2752368cb46a..92b84f4b4fb3 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.EndpointsParser.cs +++ b/src/Validation/gen/Parsers/ValidationsGenerator.EndpointsParser.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; public sealed partial class ValidationsGenerator : IIncrementalGenerator { diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.TypesParser.cs b/src/Validation/gen/Parsers/ValidationsGenerator.TypesParser.cs similarity index 99% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.TypesParser.cs rename to src/Validation/gen/Parsers/ValidationsGenerator.TypesParser.cs index 482a90c334b0..1ee0722694f4 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.TypesParser.cs +++ b/src/Validation/gen/Parsers/ValidationsGenerator.TypesParser.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Operations; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; public sealed partial class ValidationsGenerator : IIncrementalGenerator { diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/ValidationsGenerator.cs b/src/Validation/gen/ValidationsGenerator.cs similarity index 92% rename from src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/ValidationsGenerator.cs rename to src/Validation/gen/ValidationsGenerator.cs index a538dde7fcda..5f7c2c878ac5 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/ValidationsGenerator.cs +++ b/src/Validation/gen/ValidationsGenerator.cs @@ -4,9 +4,9 @@ using System.Linq; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator; +namespace Microsoft.Extensions.Validation; -[Generator] +[Generator(LanguageNames.CSharp)] public sealed partial class ValidationsGenerator : IIncrementalGenerator { public void Initialize(IncrementalGeneratorInitializationContext context) @@ -18,7 +18,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) ); // Extract types that have been marked with [ValidatableType]. var validatableTypesWithAttribute = context.SyntaxProvider.ForAttributeWithMetadataName( - "Microsoft.AspNetCore.Http.Validation.ValidatableTypeAttribute", + "Microsoft.Extensions.Validation.ValidatableTypeAttribute", predicate: ShouldTransformSymbolWithAttribute, transform: TransformValidatableTypeWithAttribute ); diff --git a/src/Http/Http.Abstractions/src/Validation/IValidatableInfo.cs b/src/Validation/src/IValidatableInfo.cs similarity index 94% rename from src/Http/Http.Abstractions/src/Validation/IValidatableInfo.cs rename to src/Validation/src/IValidatableInfo.cs index d2a7ccd1fbcf..4b5ab3cd24b2 100644 --- a/src/Http/Http.Abstractions/src/Validation/IValidatableInfo.cs +++ b/src/Validation/src/IValidatableInfo.cs @@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Represents an interface for validating a value. diff --git a/src/Http/Http.Abstractions/src/Validation/IValidatableInfoResolver.cs b/src/Validation/src/IValidatableInfoResolver.cs similarity index 97% rename from src/Http/Http.Abstractions/src/Validation/IValidatableInfoResolver.cs rename to src/Validation/src/IValidatableInfoResolver.cs index 80a2f0d0d748..706204ab6284 100644 --- a/src/Http/Http.Abstractions/src/Validation/IValidatableInfoResolver.cs +++ b/src/Validation/src/IValidatableInfoResolver.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Provides an interface for resolving the validation information associated diff --git a/src/Validation/src/Microsoft.Extensions.Validation.csproj b/src/Validation/src/Microsoft.Extensions.Validation.csproj new file mode 100644 index 000000000000..72d50e224f42 --- /dev/null +++ b/src/Validation/src/Microsoft.Extensions.Validation.csproj @@ -0,0 +1,23 @@ + + + + Common validation abstractions and validation infrastructure for .NET applications. + $(DefaultNetCoreTargetFramework) + true + true + validation + true + true + true + + + + + + + + + + + + diff --git a/src/Validation/src/PublicAPI.Shipped.txt b/src/Validation/src/PublicAPI.Shipped.txt new file mode 100644 index 000000000000..815c92006af7 --- /dev/null +++ b/src/Validation/src/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable \ No newline at end of file diff --git a/src/Validation/src/PublicAPI.Unshipped.txt b/src/Validation/src/PublicAPI.Unshipped.txt new file mode 100644 index 000000000000..ce3b07db31b0 --- /dev/null +++ b/src/Validation/src/PublicAPI.Unshipped.txt @@ -0,0 +1,40 @@ +#nullable enable +Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions +Microsoft.Extensions.Validation.IValidatableInfo +Microsoft.Extensions.Validation.IValidatableInfo.ValidateAsync(object? value, Microsoft.Extensions.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +Microsoft.Extensions.Validation.IValidatableInfoResolver +Microsoft.Extensions.Validation.IValidatableInfoResolver.TryGetValidatableParameterInfo(System.Reflection.ParameterInfo! parameterInfo, out Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) -> bool +Microsoft.Extensions.Validation.IValidatableInfoResolver.TryGetValidatableTypeInfo(System.Type! type, out Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) -> bool +Microsoft.Extensions.Validation.ValidatableParameterInfo +Microsoft.Extensions.Validation.ValidatableParameterInfo.ValidatableParameterInfo(System.Type! parameterType, string! name, string! displayName) -> void +Microsoft.Extensions.Validation.ValidatablePropertyInfo +Microsoft.Extensions.Validation.ValidatablePropertyInfo.ValidatablePropertyInfo(System.Type! declaringType, System.Type! propertyType, string! name, string! displayName) -> void +Microsoft.Extensions.Validation.ValidatableTypeAttribute +Microsoft.Extensions.Validation.ValidatableTypeAttribute.ValidatableTypeAttribute() -> void +Microsoft.Extensions.Validation.ValidatableTypeInfo +Microsoft.Extensions.Validation.ValidatableTypeInfo.ValidatableTypeInfo(System.Type! type, System.Collections.Generic.IReadOnlyList! members) -> void +Microsoft.Extensions.Validation.ValidateContext +Microsoft.Extensions.Validation.ValidateContext.CurrentDepth.get -> int +Microsoft.Extensions.Validation.ValidateContext.CurrentDepth.set -> void +Microsoft.Extensions.Validation.ValidateContext.CurrentValidationPath.get -> string! +Microsoft.Extensions.Validation.ValidateContext.CurrentValidationPath.set -> void +Microsoft.Extensions.Validation.ValidateContext.ValidateContext() -> void +Microsoft.Extensions.Validation.ValidateContext.ValidationContext.get -> System.ComponentModel.DataAnnotations.ValidationContext! +Microsoft.Extensions.Validation.ValidateContext.ValidationContext.set -> void +Microsoft.Extensions.Validation.ValidateContext.ValidationErrors.get -> System.Collections.Generic.Dictionary? +Microsoft.Extensions.Validation.ValidateContext.ValidationErrors.set -> void +Microsoft.Extensions.Validation.ValidateContext.ValidationOptions.get -> Microsoft.Extensions.Validation.ValidationOptions! +Microsoft.Extensions.Validation.ValidateContext.ValidationOptions.set -> void +Microsoft.Extensions.Validation.ValidationOptions +Microsoft.Extensions.Validation.ValidationOptions.MaxDepth.get -> int +Microsoft.Extensions.Validation.ValidationOptions.MaxDepth.set -> void +Microsoft.Extensions.Validation.ValidationOptions.Resolvers.get -> System.Collections.Generic.IList! +Microsoft.Extensions.Validation.ValidationOptions.TryGetValidatableParameterInfo(System.Reflection.ParameterInfo! parameterInfo, out Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) -> bool +Microsoft.Extensions.Validation.ValidationOptions.TryGetValidatableTypeInfo(System.Type! type, out Microsoft.Extensions.Validation.IValidatableInfo? validatableTypeInfo) -> bool +Microsoft.Extensions.Validation.ValidationOptions.ValidationOptions() -> void +abstract Microsoft.Extensions.Validation.ValidatableParameterInfo.GetValidationAttributes() -> System.ComponentModel.DataAnnotations.ValidationAttribute![]! +abstract Microsoft.Extensions.Validation.ValidatablePropertyInfo.GetValidationAttributes() -> System.ComponentModel.DataAnnotations.ValidationAttribute![]! +static Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action? configureOptions = null) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! +virtual Microsoft.Extensions.Validation.ValidatableParameterInfo.ValidateAsync(object? value, Microsoft.Extensions.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +virtual Microsoft.Extensions.Validation.ValidatablePropertyInfo.ValidateAsync(object? value, Microsoft.Extensions.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +virtual Microsoft.Extensions.Validation.ValidatableTypeInfo.ValidateAsync(object? value, Microsoft.Extensions.Validation.ValidateContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! \ No newline at end of file diff --git a/src/Http/Http.Abstractions/src/Validation/RuntimeValidatableParameterInfoResolver.cs b/src/Validation/src/RuntimeValidatableParameterInfoResolver.cs similarity index 92% rename from src/Http/Http.Abstractions/src/Validation/RuntimeValidatableParameterInfoResolver.cs rename to src/Validation/src/RuntimeValidatableParameterInfoResolver.cs index 0728c3ac8b8d..d8f0c3699dbf 100644 --- a/src/Http/Http.Abstractions/src/Validation/RuntimeValidatableParameterInfoResolver.cs +++ b/src/Validation/src/RuntimeValidatableParameterInfoResolver.cs @@ -10,7 +10,7 @@ using System.Reflection; using System.Security.Claims; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; internal sealed class RuntimeValidatableParameterInfoResolver : IValidatableInfoResolver { @@ -86,12 +86,6 @@ private static bool IsClass(Type type) type == typeof(DateOnly) || type == typeof(TimeSpan) || type == typeof(Guid) || - type == typeof(IFormFile) || - type == typeof(IFormFileCollection) || - type == typeof(IFormCollection) || - type == typeof(HttpContext) || - type == typeof(HttpRequest) || - type == typeof(HttpResponse) || type == typeof(ClaimsPrincipal) || type == typeof(CancellationToken) || type == typeof(Stream) || diff --git a/src/Http/Http.Abstractions/src/Validation/TypeExtensions.cs b/src/Validation/src/TypeExtensions.cs similarity index 99% rename from src/Http/Http.Abstractions/src/Validation/TypeExtensions.cs rename to src/Validation/src/TypeExtensions.cs index 244f0b3fe888..0b11e6ec45e5 100644 --- a/src/Http/Http.Abstractions/src/Validation/TypeExtensions.cs +++ b/src/Validation/src/TypeExtensions.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; internal static class TypeExtensions { diff --git a/src/Http/Http.Abstractions/src/Validation/ValidatableParameterInfo.cs b/src/Validation/src/ValidatableParameterInfo.cs similarity index 99% rename from src/Http/Http.Abstractions/src/Validation/ValidatableParameterInfo.cs rename to src/Validation/src/ValidatableParameterInfo.cs index 48de32c0daff..8481887ff8ce 100644 --- a/src/Http/Http.Abstractions/src/Validation/ValidatableParameterInfo.cs +++ b/src/Validation/src/ValidatableParameterInfo.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Contains validation information for a parameter. diff --git a/src/Http/Http.Abstractions/src/Validation/ValidatablePropertyInfo.cs b/src/Validation/src/ValidatablePropertyInfo.cs similarity index 99% rename from src/Http/Http.Abstractions/src/Validation/ValidatablePropertyInfo.cs rename to src/Validation/src/ValidatablePropertyInfo.cs index 0b16e34d1dc9..b73a8968fd62 100644 --- a/src/Http/Http.Abstractions/src/Validation/ValidatablePropertyInfo.cs +++ b/src/Validation/src/ValidatablePropertyInfo.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Contains validation information for a member of a type. diff --git a/src/Http/Http.Abstractions/src/Validation/ValidatableTypeAttribute.cs b/src/Validation/src/ValidatableTypeAttribute.cs similarity index 90% rename from src/Http/Http.Abstractions/src/Validation/ValidatableTypeAttribute.cs rename to src/Validation/src/ValidatableTypeAttribute.cs index a36402ecc408..c2af4cb2a7da 100644 --- a/src/Http/Http.Abstractions/src/Validation/ValidatableTypeAttribute.cs +++ b/src/Validation/src/ValidatableTypeAttribute.cs @@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Indicates that a type is validatable to support discovery by the diff --git a/src/Http/Http.Abstractions/src/Validation/ValidatableTypeInfo.cs b/src/Validation/src/ValidatableTypeInfo.cs similarity index 99% rename from src/Http/Http.Abstractions/src/Validation/ValidatableTypeInfo.cs rename to src/Validation/src/ValidatableTypeInfo.cs index 6245c43c1b69..936a30d52d3b 100644 --- a/src/Http/Http.Abstractions/src/Validation/ValidatableTypeInfo.cs +++ b/src/Validation/src/ValidatableTypeInfo.cs @@ -5,7 +5,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Contains validation information for a type. diff --git a/src/Http/Http.Abstractions/src/Validation/ValidateContext.cs b/src/Validation/src/ValidateContext.cs similarity index 98% rename from src/Http/Http.Abstractions/src/Validation/ValidateContext.cs rename to src/Validation/src/ValidateContext.cs index d38ada2ddeb1..b27408ce4844 100644 --- a/src/Http/Http.Abstractions/src/Validation/ValidateContext.cs +++ b/src/Validation/src/ValidateContext.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Represents the context for validating a validatable object. diff --git a/src/Http/Http.Abstractions/src/Validation/ValidationOptions.cs b/src/Validation/src/ValidationOptions.cs similarity index 98% rename from src/Http/Http.Abstractions/src/Validation/ValidationOptions.cs rename to src/Validation/src/ValidationOptions.cs index dc83ce9282a7..13729b5f124a 100644 --- a/src/Http/Http.Abstractions/src/Validation/ValidationOptions.cs +++ b/src/Validation/src/ValidationOptions.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; -namespace Microsoft.AspNetCore.Http.Validation; +namespace Microsoft.Extensions.Validation; /// /// Provides configuration options for the validation system. diff --git a/src/Http/Http.Abstractions/src/Validation/ValidationServiceCollectionExtensions.cs b/src/Validation/src/ValidationServiceCollectionExtensions.cs similarity index 97% rename from src/Http/Http.Abstractions/src/Validation/ValidationServiceCollectionExtensions.cs rename to src/Validation/src/ValidationServiceCollectionExtensions.cs index bc4f6a77abaf..91d45a8d263e 100644 --- a/src/Http/Http.Abstractions/src/Validation/ValidationServiceCollectionExtensions.cs +++ b/src/Validation/src/ValidationServiceCollectionExtensions.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; namespace Microsoft.Extensions.DependencyInjection; diff --git a/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/Microsoft.Extensions.Validation.GeneratorTests.csproj b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/Microsoft.Extensions.Validation.GeneratorTests.csproj new file mode 100644 index 000000000000..96f34d7eeef6 --- /dev/null +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/Microsoft.Extensions.Validation.GeneratorTests.csproj @@ -0,0 +1,33 @@ + + + + $(DefaultNetCoreTargetFramework) + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ModuleInitializer.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ModuleInitializer.cs new file mode 100644 index 000000000000..2e42614606d4 --- /dev/null +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ModuleInitializer.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; + +public static class ModuleInitializer +{ + [ModuleInitializer] + public static void Init() => + VerifySourceGenerators.Initialize(); +} diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.ComplexType.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.ComplexType.cs similarity index 99% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.ComplexType.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.ComplexType.cs index 50cd7eca1769..7bdf0bea29b2 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.ComplexType.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.ComplexType.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -16,7 +18,7 @@ public async Task CanValidateComplexTypes() using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.IValidatableObject.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.IValidatableObject.cs similarity index 98% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.IValidatableObject.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.IValidatableObject.cs index 70f1d725bc70..590195468298 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.IValidatableObject.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.IValidatableObject.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -14,7 +14,7 @@ public async Task CanValidateIValidatableObject() using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.MultipleNamespaces.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.MultipleNamespaces.cs similarity index 96% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.MultipleNamespaces.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.MultipleNamespaces.cs index 58478ece957e..e08f8855a4a3 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.MultipleNamespaces.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.MultipleNamespaces.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -16,7 +18,7 @@ public async Task CanValidateMultipleNamespaces() using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.NoOp.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.NoOp.cs similarity index 96% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.NoOp.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.NoOp.cs index 410c74a5cecc..ba176e622450 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.NoOp.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.NoOp.cs @@ -1,7 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +using Microsoft.AspNetCore.Http; +using Xunit; + +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -16,7 +19,7 @@ public async Task DoesNotEmitIfNoAddValidationCallExists() using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; @@ -62,7 +65,7 @@ public async Task DoesNotEmitIfNotCorrectAddValidationCallExists() using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; @@ -126,7 +129,7 @@ public async Task DoesNotEmitForExemptTypes() using System.Threading; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.Extensions.DependencyInjection; var builder = WebApplication.CreateBuilder(); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Parameters.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parameters.cs similarity index 96% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Parameters.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parameters.cs index f05f80999147..5b90338520eb 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Parameters.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parameters.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -15,7 +17,7 @@ public async Task CanValidateParameters() using System.Linq; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Parsable.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs similarity index 97% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Parsable.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs index 6cebd6df8584..6ea212ebaa16 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Parsable.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -16,7 +16,7 @@ public async Task CanValidateTypeWithParsableProperties() using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Polymorphism.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Polymorphism.cs similarity index 98% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Polymorphism.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Polymorphism.cs index 54148e784a0a..39dbec97a78c 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Polymorphism.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Polymorphism.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -15,7 +15,7 @@ public async Task CanValidatePolymorphicTypes() using System.Text.Json.Serialization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.RecordType.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.RecordType.cs similarity index 99% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.RecordType.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.RecordType.cs index 4f296c66d648..cfc1372b9a7a 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.RecordType.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.RecordType.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -16,7 +18,7 @@ public async Task CanValidateRecordTypes() using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Recursion.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Recursion.cs similarity index 98% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Recursion.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Recursion.cs index 4affa35f8997..7367e2919ae0 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.Recursion.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Recursion.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.ValidatableType.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.ValidatableType.cs similarity index 99% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.ValidatableType.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.ValidatableType.cs index 0ddc3613249f..c471d99da183 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGenerator.ValidatableType.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.ValidatableType.cs @@ -4,9 +4,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +namespace Microsoft.Extensions.Validation.GeneratorTests; public partial class ValidationsGeneratorTests : ValidationsGeneratorTestBase { @@ -22,7 +22,7 @@ public async Task CanValidateTypesWithAttribute() using System.Linq; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Validation; +using Microsoft.Extensions.Validation; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGeneratorTestBase.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGeneratorTestBase.cs similarity index 94% rename from src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGeneratorTestBase.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGeneratorTestBase.cs index bb1cd12470d3..80c24c4a6070 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/ValidationsGeneratorTestBase.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGeneratorTestBase.cs @@ -10,22 +10,28 @@ using System.Text; using System.Text.Json; using System.Text.RegularExpressions; +using System.IO.Pipelines; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting.Server; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Http.Validation; using Microsoft.AspNetCore.InternalTesting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Routing; +using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using static Microsoft.AspNetCore.Http.Generators.Tests.RequestDelegateCreationTestBase; +using Microsoft.Extensions.Validation; +using Xunit; -namespace Microsoft.AspNetCore.Http.ValidationsGenerator.Tests; +namespace Microsoft.Extensions.Validation.GeneratorTests; [UsesVerify] public partial class ValidationsGeneratorTestBase : LoggedTestBase @@ -34,7 +40,7 @@ public partial class ValidationsGeneratorTestBase : LoggedTestBase private static partial Regex InterceptsLocationRegex(); private static readonly CSharpParseOptions ParseOptions = new CSharpParseOptions(LanguageVersion.Preview) - .WithFeatures([new KeyValuePair("InterceptorsNamespaces", "Microsoft.AspNetCore.Http.Validation.Generated")]); + .WithFeatures([new KeyValuePair("InterceptorsNamespaces", "Microsoft.Extensions.Validation.Generated")]); internal static Task Verify(string source, out Compilation compilation) { @@ -53,6 +59,8 @@ internal static Task Verify(string source, out Compilation compilation) MetadataReference.CreateFromFile(typeof(System.Text.Json.Nodes.JsonArray).Assembly.Location), MetadataReference.CreateFromFile(typeof(Console).Assembly.Location), MetadataReference.CreateFromFile(typeof(Uri).Assembly.Location), + MetadataReference.CreateFromFile(typeof(IFormFileCollection).Assembly.Location), + MetadataReference.CreateFromFile(typeof(PipeReader).Assembly.Location), MetadataReference.CreateFromFile(typeof(System.ComponentModel.DataAnnotations.ValidationAttribute).Assembly.Location), MetadataReference.CreateFromFile(typeof(RouteData).Assembly.Location), MetadataReference.CreateFromFile(typeof(IFeatureCollection).Assembly.Location), @@ -62,6 +70,7 @@ internal static Task Verify(string source, out Compilation compilation) MetadataReference.CreateFromFile(typeof(HttpJsonServiceExtensions).Assembly.Location), MetadataReference.CreateFromFile(typeof(IValidatableInfoResolver).Assembly.Location), MetadataReference.CreateFromFile(typeof(EndpointFilterFactoryContext).Assembly.Location), + MetadataReference.CreateFromFile(typeof(ValidationServiceCollectionExtensions).Assembly.Location), ]); var inputCompilation = CSharpCompilation.Create("ValidationsGeneratorSample", [CSharpSyntaxTree.ParseText(source, options: ParseOptions, path: "Program.cs")], @@ -72,19 +81,20 @@ internal static Task Verify(string source, out Compilation compilation) return Verifier .Verify(driver.RunGeneratorsAndUpdateCompilation(inputCompilation, out compilation, out var diagnostics)) .ScrubLinesWithReplace(line => InterceptsLocationRegex().Replace(line, "[InterceptsLocation]")) - .UseDirectory(SkipOnHelixAttribute.OnHelix() - ? Path.Combine(Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"), "ValidationsGenerator", "snapshots") + .UseDirectory(SkipOnHelixAttribute.OnHelix() && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT") is { } workItemRoot + ? Path.Combine(workItemRoot, "ValidationsGenerator", "snapshots") : "snapshots"); } internal static void VerifyValidatableType(Compilation compilation, string typeName, Action verifyFunc) { - if (TryResolveServicesFromCompilation(compilation, targetAssemblyName: "Microsoft.AspNetCore.Http.Abstractions", typeName: "Microsoft.AspNetCore.Http.Validation.ValidationOptions", out var services, out var serviceType, out var outputAssemblyName) is false) + if (TryResolveServicesFromCompilation(compilation, targetAssemblyName: "Microsoft.Extensions.Validation", typeName: "Microsoft.Extensions.Validation.ValidationOptions", out var services, out var serviceType, out var outputAssemblyName) is false) { throw new InvalidOperationException("Could not resolve services from compilation."); } var targetAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(assembly => assembly.GetName().Name == outputAssemblyName); - var type = targetAssembly.GetType(typeName, throwOnError: false); + var type = targetAssembly?.GetType(typeName, throwOnError: false); + Debug.Assert(type != null, $"Could not find type {typeName} in assembly {outputAssemblyName}."); // Get IOptions first var optionsType = typeof(IOptions<>).MakeGenericType(serviceType); @@ -583,4 +593,14 @@ internal static async Task AssertBadRequest(HttpCo var responseBody = await reader.ReadToEndAsync(); return JsonSerializer.Deserialize(responseBody); } + + internal sealed class RequestBodyDetectionFeature : IHttpRequestBodyDetectionFeature + { + public RequestBodyDetectionFeature(bool canHaveBody) + { + CanHaveBody = canHaveBody; + } + + public bool CanHaveBody { get; } + } } diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateComplexTypes#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateComplexTypes#ValidatableInfoResolver.g.received.cs similarity index 89% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateComplexTypes#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateComplexTypes#ValidatableInfoResolver.g.received.cs index 5105b0ca70cd..6ed50bc4cf76 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateComplexTypes#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateComplexTypes#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::SubType)) @@ -166,18 +166,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -191,7 +191,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateIValidatableObject#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateIValidatableObject#ValidatableInfoResolver.g.received.cs similarity index 86% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateIValidatableObject#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateIValidatableObject#ValidatableInfoResolver.g.received.cs index 6323e4ce9ff8..0e714f920f11 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateIValidatableObject#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateIValidatableObject#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::SubType)) @@ -117,18 +117,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -142,7 +142,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateMultipleNamespaces#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateMultipleNamespaces#ValidatableInfoResolver.g.received.cs similarity index 85% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateMultipleNamespaces#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateMultipleNamespaces#ValidatableInfoResolver.g.received.cs index ccf60a0a1c89..25df8f453930 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateMultipleNamespaces#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateMultipleNamespaces#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::NamespaceOne.Type)) @@ -97,18 +97,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -122,7 +122,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateParameters#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateParameters#ValidatableInfoResolver.g.received.cs similarity index 87% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateParameters#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateParameters#ValidatableInfoResolver.g.received.cs index d962c3758088..eb73f425fad1 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateParameters#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateParameters#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::TestService)) @@ -115,18 +115,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -140,7 +140,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidatePolymorphicTypes#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidatePolymorphicTypes#ValidatableInfoResolver.g.received.cs similarity index 88% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidatePolymorphicTypes#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidatePolymorphicTypes#ValidatableInfoResolver.g.received.cs index c6cd2b9a6aeb..a2520c96a2a2 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidatePolymorphicTypes#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidatePolymorphicTypes#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::DerivedType)) @@ -147,18 +147,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -172,7 +172,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateRecordTypes#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateRecordTypes#ValidatableInfoResolver.g.received.cs similarity index 90% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateRecordTypes#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateRecordTypes#ValidatableInfoResolver.g.received.cs index 29b8c10bb51e..a2ba7cbdc855 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateRecordTypes#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateRecordTypes#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::SubType)) @@ -193,18 +193,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -218,7 +218,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateRecursiveTypes#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateRecursiveTypes#ValidatableInfoResolver.g.received.cs similarity index 85% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateRecursiveTypes#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateRecursiveTypes#ValidatableInfoResolver.g.received.cs index 7625d563e861..f61ce950aac1 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateRecursiveTypes#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateRecursiveTypes#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::RecursiveType)) @@ -88,18 +88,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -113,7 +113,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateTypeWithParsableProperties#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateTypeWithParsableProperties#ValidatableInfoResolver.g.received.cs similarity index 88% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateTypeWithParsableProperties#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateTypeWithParsableProperties#ValidatableInfoResolver.g.received.cs index cc22f8dc30d9..9641ecbc3032 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateTypeWithParsableProperties#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateTypeWithParsableProperties#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::ComplexTypeWithParsableProperties)) @@ -130,18 +130,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -155,7 +155,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateTypesWithAttribute#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateTypesWithAttribute#ValidatableInfoResolver.g.received.cs similarity index 89% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateTypesWithAttribute#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateTypesWithAttribute#ValidatableInfoResolver.g.received.cs index 880d416cfc13..52220c7918fa 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateTypesWithAttribute#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.CanValidateTypesWithAttribute#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::SubType)) @@ -160,18 +160,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -185,7 +185,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.DoesNotEmitForExemptTypes#ValidatableInfoResolver.g.verified.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.DoesNotEmitForExemptTypes#ValidatableInfoResolver.g.received.cs similarity index 84% rename from src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.DoesNotEmitForExemptTypes#ValidatableInfoResolver.g.verified.cs rename to src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.DoesNotEmitForExemptTypes#ValidatableInfoResolver.g.received.cs index be9ab29fec62..e4bf2083af57 100644 --- a/src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.DoesNotEmitForExemptTypes#ValidatableInfoResolver.g.verified.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/snapshots/ValidationsGeneratorTests.DoesNotEmitForExemptTypes#ValidatableInfoResolver.g.received.cs @@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : System.Attribute { @@ -23,10 +23,10 @@ public InterceptsLocationAttribute(int version, string data) } } -namespace Microsoft.AspNetCore.Http.Validation.Generated +namespace Microsoft.Extensions.Validation.Generated { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatablePropertyInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatablePropertyInfo : global::Microsoft.Extensions.Validation.ValidatablePropertyInfo { public GeneratedValidatablePropertyInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] @@ -47,8 +47,8 @@ public GeneratedValidatablePropertyInfo( => ValidationAttributeCache.GetValidationAttributes(ContainingType, Name); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file sealed class GeneratedValidatableTypeInfo : global::Microsoft.AspNetCore.Http.Validation.ValidatableTypeInfo + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file sealed class GeneratedValidatableTypeInfo : global::Microsoft.Extensions.Validation.ValidatableTypeInfo { public GeneratedValidatableTypeInfo( [param: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] @@ -56,10 +56,10 @@ public GeneratedValidatableTypeInfo( ValidatablePropertyInfo[] members) : base(type, members) { } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] - file class GeneratedValidatableInfoResolver : global::Microsoft.AspNetCore.Http.Validation.IValidatableInfoResolver + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + file class GeneratedValidatableInfoResolver : global::Microsoft.Extensions.Validation.IValidatableInfoResolver { - public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; if (type == typeof(global::ComplexType)) @@ -82,18 +82,18 @@ public bool TryGetValidatableTypeInfo(global::System.Type type, [global::System. } // No-ops, rely on runtime code for ParameterInfo-based resolution - public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.AspNetCore.Http.Validation.IValidatableInfo? validatableInfo) + public bool TryGetValidatableParameterInfo(global::System.Reflection.ParameterInfo parameterInfo, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out global::Microsoft.Extensions.Validation.IValidatableInfo? validatableInfo) { validatableInfo = null; return false; } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class GeneratedServiceCollectionExtensions { [InterceptsLocation] - public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) + public static global::Microsoft.Extensions.DependencyInjection.IServiceCollection AddValidation(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::System.Action? configureOptions = null) { // Use non-extension method to avoid infinite recursion. return global::Microsoft.Extensions.DependencyInjection.ValidationServiceCollectionExtensions.AddValidation(services, options => @@ -107,7 +107,7 @@ file static class GeneratedServiceCollectionExtensions } } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Validation.ValidationsGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file static class ValidationAttributeCache { private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName); diff --git a/src/Validation/test/Microsoft.Extensions.Validation.Tests/Microsoft.Extensions.Validation.Tests.csproj b/src/Validation/test/Microsoft.Extensions.Validation.Tests/Microsoft.Extensions.Validation.Tests.csproj new file mode 100644 index 000000000000..f74f56690452 --- /dev/null +++ b/src/Validation/test/Microsoft.Extensions.Validation.Tests/Microsoft.Extensions.Validation.Tests.csproj @@ -0,0 +1,13 @@ + + + + $(DefaultNetCoreTargetFramework) + enable + + + + + + + + diff --git a/src/Http/Http.Abstractions/test/Validation/RuntimeValidatableParameterInfoResolverTests.cs b/src/Validation/test/Microsoft.Extensions.Validation.Tests/RuntimeValidatableParameterInfoResolverTests.cs similarity index 95% rename from src/Http/Http.Abstractions/test/Validation/RuntimeValidatableParameterInfoResolverTests.cs rename to src/Validation/test/Microsoft.Extensions.Validation.Tests/RuntimeValidatableParameterInfoResolverTests.cs index e5f268ab4c32..eebe4032d9af 100644 --- a/src/Http/Http.Abstractions/test/Validation/RuntimeValidatableParameterInfoResolverTests.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.Tests/RuntimeValidatableParameterInfoResolverTests.cs @@ -6,7 +6,7 @@ using System.Reflection; using System.Security.Claims; -namespace Microsoft.AspNetCore.Http.Validation.Tests; +namespace Microsoft.Extensions.Validation.Tests; public class RuntimeValidatableParameterInfoResolverTests { @@ -46,12 +46,6 @@ public void TryGetValidatableParameterInfo_WithNullName_ThrowsInvalidOperationEx [InlineData(typeof(TimeOnly))] [InlineData(typeof(DateOnly))] [InlineData(typeof(TimeSpan))] - [InlineData(typeof(IFormFile))] - [InlineData(typeof(IFormFileCollection))] - [InlineData(typeof(IFormCollection))] - [InlineData(typeof(HttpContext))] - [InlineData(typeof(HttpRequest))] - [InlineData(typeof(HttpResponse))] [InlineData(typeof(CancellationToken))] public void TryGetValidatableParameterInfo_WithSimpleTypesAndNoAttributes_ReturnsFalse(Type parameterType) { diff --git a/src/Http/Http.Abstractions/test/Validation/ValidatableInfoResolverTests.cs b/src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableInfoResolverTests.cs similarity index 99% rename from src/Http/Http.Abstractions/test/Validation/ValidatableInfoResolverTests.cs rename to src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableInfoResolverTests.cs index ab197cf6fde8..0a745a62a209 100644 --- a/src/Http/Http.Abstractions/test/Validation/ValidatableInfoResolverTests.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableInfoResolverTests.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.Options; using Moq; -namespace Microsoft.AspNetCore.Http.Validation.Tests; +namespace Microsoft.Extensions.Validation.Tests; public class ValidatableInfoResolverTests { diff --git a/src/Http/Http.Abstractions/test/Validation/ValidatableParameterInfoTests.cs b/src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableParameterInfoTests.cs similarity index 99% rename from src/Http/Http.Abstractions/test/Validation/ValidatableParameterInfoTests.cs rename to src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableParameterInfoTests.cs index e10614b2b19e..3ede11071d3d 100644 --- a/src/Http/Http.Abstractions/test/Validation/ValidatableParameterInfoTests.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableParameterInfoTests.cs @@ -8,7 +8,7 @@ using System.Reflection; using Microsoft.Extensions.DependencyInjection; -namespace Microsoft.AspNetCore.Http.Validation.Tests; +namespace Microsoft.Extensions.Validation.Tests; public class ValidatableParameterInfoTests { diff --git a/src/Http/Http.Abstractions/test/Validation/ValidatableTypeInfoTests.cs b/src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableTypeInfoTests.cs similarity index 99% rename from src/Http/Http.Abstractions/test/Validation/ValidatableTypeInfoTests.cs rename to src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableTypeInfoTests.cs index a6123bb11c67..775ad0e947ee 100644 --- a/src/Http/Http.Abstractions/test/Validation/ValidatableTypeInfoTests.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.Tests/ValidatableTypeInfoTests.cs @@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; -namespace Microsoft.AspNetCore.Http.Validation.Tests; +namespace Microsoft.Extensions.Validation.Tests; public class ValidatableTypeInfoTests {