├── .github ├── FUNDING.yml ├── release.yml └── workflows │ ├── publish.yml │ └── develop.yml ├── Icon.png ├── Banner.png ├── global.json ├── src └── GeneratedEndpoints │ ├── Common │ ├── Parameter.cs │ ├── ConfigureMethodDetails.cs │ ├── ProducesProblemMetadata.cs │ ├── ProducesValidationProblemMetadata.cs │ ├── HttpAttributeDefinition.cs │ ├── AcceptsMetadata.cs │ ├── ProducesMetadata.cs │ ├── EndpointGroup.cs │ ├── BindingSource.cs │ ├── RequestHandlerAttributeKind.cs │ ├── DeclarationType.cs │ ├── RequestHandlerComparer.cs │ ├── RequestHandlerMethodHelper.cs │ ├── AttributeSymbolMatcher.cs │ └── RequestHandler.cs │ └── Properties │ └── launchSettings.json ├── tests ├── GeneratedEndpoints.Tests.Lab │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── GeneratedEndpoints.Tests.Lab.csproj └── GeneratedEndpoints.Tests │ ├── Common │ ├── ModuleInitializer.cs │ └── ScenarioNamer.cs │ ├── IndividualTests.MapGetEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapHeadEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapPatchEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapPostEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapPutEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapQueryEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapTraceEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassEndpointFilter_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ConfigureAddsMetadata_AddEndpointHandlers.verified.txt │ ├── IndividualTests.CustomFallbackRoute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.DefaultFallbackOnly_AddEndpointHandlers.verified.txt │ ├── IndividualTests.GenericEndpointFilter_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapConnectEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapDeleteEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MapOptionsEndpoint_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodEndpointFilter_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodNameCollision_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ConfigureRegistersFilter_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ConfigureWithServiceProvider_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MultipleEndpointNameCollisions_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.HttpMethodMatrix_346DFFBCB949_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.HttpMethodMatrix_434E7BEC9B3F_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.HttpMethodMatrix_541EF512DD7F_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.HttpMethodMatrix_DC18F4695C80_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.HttpMethodMatrix_F1EDE56BC773_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_370EBA0910FD_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_50C6E889EAF2_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_517225B7419F_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_61D3AB7FBEBA_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_A7D17F3BAD82_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_25B08C7DE832_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_401A05F2C177_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_A172502B995B_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_B46DF1784969_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_EFC1A0B7E7CE_AddEndpointHandlers.verified.txt │ ├── AttributeGenerationTests.ShortCircuitAttribute.verified.txt │ ├── AttributeGenerationTests.DisableAntiforgeryAttribute.verified.txt │ ├── AttributeGenerationTests.DisableRequestTimeoutAttribute.verified.txt │ ├── IndividualTests.AsParameters_AddEndpointHandlers.verified.txt │ ├── IndividualTests.BindingNames_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ContractTags_AddEndpointHandlers.verified.txt │ ├── IndividualTests.FromServices_AddEndpointHandlers.verified.txt │ ├── IndividualTests.AcceptsAttribute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.FromKeyedServices_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_0BE3EC6390D4_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_2F85DF1A025B_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_89F17B97AFD0_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_9F7075874154_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassTags_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ContractAllowAnonymous_AddEndpointHandlers.verified.txt │ ├── IndividualTests.DisplayNameAttribute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.GroupName_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodTags_AddEndpointHandlers.verified.txt │ ├── IndividualTests.AcceptsMultipleContentTypes_AddEndpointHandlers.verified.txt │ ├── IndividualTests.AsyncMethodVariants_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassMapGroup_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireCors_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireHost_AddEndpointHandlers.verified.txt │ ├── IndividualTests.GenericAcceptsAttribute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.OrderMetadata_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesProblemAttribute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesResponseAttribute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.RequestTimeout_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ShortCircuit_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassAllowAnonymous_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ContractExcludeFromDescription_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ContractRequireAuthorization_AddEndpointHandlers.verified.txt │ ├── IndividualTests.DisableRequestTimeout_AddEndpointHandlers.verified.txt │ ├── IndividualTests.GenericProducesResponseAttribute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodAllowAnonymous_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireCors_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireHost_AddEndpointHandlers.verified.txt │ ├── IndividualTests.RequireRateLimiting_AddEndpointHandlers.verified.txt │ ├── IndividualTests.SummaryAndDescriptionAttributes_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.AuthorizationAndMetadataMatrix_6F94B85A7155_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.AuthorizationAndMetadataMatrix_9D6575ECE261_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassDisableValidation_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireAuthorization_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireCorsWithPolicy_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ExcludeFromDescription_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodDisableValidation_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireAuthorization_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesResponseMultipleContentTypes_AddEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesValidationProblemAttribute_AddEndpointHandlers.verified.txt │ ├── IndividualTests.RequestTimeoutWithPolicy_AddEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireCorsWithPolicy_AddEndpointHandlers.verified.txt │ ├── IndividualTests.RequireRateLimitingWithPolicy_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_8330CA9A1CFC_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_9F5FE6E1F139_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_DDC9B964FDBC_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ContractsAndBindingMatrix_E255BF1E7B54_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.AuthorizationAndMetadataMatrix_257E8A8FA30F_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.AuthorizationAndMetadataMatrix_25B2AC35B582_AddEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.AuthorizationAndMetadataMatrix_4F441534B0BD_AddEndpointHandlers.verified.txt │ ├── AttributeGenerationTests.DisableValidationAttribute.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_517225B7419F_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_370EBA0910FD_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapGetEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.DefaultFallbackOnly_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapPostEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapPutEndpoint_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_A7D17F3BAD82_MapEndpointHandlers.verified.txt │ ├── IndividualTests.AsParameters_MapEndpointHandlers.verified.txt │ ├── IndividualTests.BindingNames_MapEndpointHandlers.verified.txt │ ├── IndividualTests.FromServices_MapEndpointHandlers.verified.txt │ ├── IndividualTests.AcceptsAttribute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.FromKeyedServices_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapPatchEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.CustomFallbackRoute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapDeleteEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapHeadEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.AcceptsMultipleContentTypes_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapTraceEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapQueryEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.RequireRateLimiting_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ConfigureWithServiceProvider_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapConnectEndpoint_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MapOptionsEndpoint_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_50C6E889EAF2_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ContractAllowAnonymous_MapEndpointHandlers.verified.txt │ ├── IndividualTests.OrderMetadata_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ShortCircuit_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireCors_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireCors_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ClassAllowAnonymous_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ClassTags_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ContractTags_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodAllowAnonymous_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodTags_MapEndpointHandlers.verified.txt │ ├── IndividualTests.RequestTimeout_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ContractExcludeFromDescription_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ClassDisableValidation_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireHost_MapEndpointHandlers.verified.txt │ ├── IndividualTests.DisableRequestTimeout_MapEndpointHandlers.verified.txt │ ├── IndividualTests.DisplayNameAttribute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ExcludeFromDescription_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodDisableValidation_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireCorsWithPolicy_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ContractRequireAuthorization_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireCorsWithPolicy_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_B46DF1784969_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ClassRequireAuthorization_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireAuthorization_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesProblemAttribute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.RequestTimeoutWithPolicy_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodRequireHost_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesValidationProblemAttribute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.GenericAcceptsAttribute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesResponseAttribute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ConfigureAddsMetadata_MapEndpointHandlers.verified.txt │ ├── IndividualTests.GenericProducesResponseAttribute_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ConfigureRegistersFilter_MapEndpointHandlers.verified.txt │ ├── IndividualTests.RequireRateLimitingWithPolicy_MapEndpointHandlers.verified.txt │ ├── IndividualTests.ProducesResponseMultipleContentTypes_MapEndpointHandlers.verified.txt │ ├── IndividualTests.SummaryAndDescriptionAttributes_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_A172502B995B_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.MapFallbackScenarios_61D3AB7FBEBA_MapEndpointHandlers.verified.txt │ ├── AttributeGenerationTests.OrderAttribute.verified.txt │ ├── IndividualTests.ClassEndpointFilter_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_25B08C7DE832_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_401A05F2C177_MapEndpointHandlers.verified.txt │ ├── IndividualTests.GenericEndpointFilter_MapEndpointHandlers.verified.txt │ ├── IndividualTests.MethodEndpointFilter_MapEndpointHandlers.verified.txt │ ├── AttributeGenerationTests.SummaryAttribute.verified.txt │ ├── IndividualTests.GroupName_MapEndpointHandlers.verified.txt │ ├── GeneratedSourceTests.ConfigureAndFiltersMatrix_EFC1A0B7E7CE_MapEndpointHandlers.verified.txt │ ├── AttributeGenerationTests.RequireHostAttribute.verified.txt │ ├── GeneratedSourceTests.AuthorizationAndMetadataMatrix_9D6575ECE261_MapEndpointHandlers.verified.txt │ ├── AttributeGenerationTests.RequireRateLimitingAttribute.verified.txt │ └── GeneratedSourceTests.ContractsAndBindingMatrix_0BE3EC6390D4_MapEndpointHandlers.verified.txt ├── .gitignore ├── .editorconfig └── LICENSE.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: jscarle 2 | -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jscarle/GeneratedEndpoints/HEAD/Icon.png -------------------------------------------------------------------------------- /Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jscarle/GeneratedEndpoints/HEAD/Banner.png -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "10.0.0", 4 | "rollForward": "latestMajor", 5 | "allowPrerelease": false 6 | } 7 | } -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | # .github/release.yml 2 | 3 | changelog: 4 | categories: 5 | - title: Changes 6 | labels: 7 | - "*" 8 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/Parameter.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal readonly record struct Parameter(string Name, string Type, string BindingPrefix); 4 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests.Lab/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/ConfigureMethodDetails.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal readonly record struct ConfigureMethodDetails(bool HasConfigureMethod, bool ConfigureMethodAcceptsServiceProvider); 4 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests.Lab/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/ProducesProblemMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal readonly record struct ProducesProblemMetadata(int StatusCode, string? ContentType, EquatableImmutableArray? AdditionalContentTypes); 4 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/ProducesValidationProblemMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal readonly record struct ProducesValidationProblemMetadata(int StatusCode, string? ContentType, EquatableImmutableArray? AdditionalContentTypes); 4 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/HttpAttributeDefinition.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis.Text; 2 | 3 | namespace GeneratedEndpoints.Common; 4 | 5 | internal readonly record struct HttpAttributeDefinition(string Name, string FullyQualifiedName, string Hint, string Verb, SourceText SourceText); 6 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/AcceptsMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal readonly record struct AcceptsMetadata( 4 | string RequestType, 5 | string ContentType, 6 | EquatableImmutableArray? AdditionalContentTypes, 7 | bool IsOptional 8 | ); 9 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/ProducesMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal readonly record struct ProducesMetadata( 4 | string ResponseType, 5 | int StatusCode, 6 | string? ContentType, 7 | EquatableImmutableArray? AdditionalContentTypes 8 | ); 9 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/EndpointGroup.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal readonly record struct EndpointGroup 4 | { 5 | public required string Identifier { get; init; } 6 | public required string Pattern { get; init; } 7 | public required string? Name { get; init; } 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build results 2 | bin/ 3 | obj/ 4 | 5 | # Visual Studio files 6 | .vs 7 | 8 | # JetBrains IDE configuration 9 | .idea 10 | *.DotSettings.user 11 | 12 | # Backup files 13 | *.bak 14 | 15 | # Docs 16 | docfx/_site/** 17 | docfx/netstandard2.0/** 18 | docfx/net6.0/** 19 | docfx/net7.0/** 20 | docfx/net8.0/** 21 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests.Lab/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Generated.Routing; 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | builder.Services.AddEndpointHandlers(); 7 | 8 | var app = builder.Build(); 9 | 10 | app.MapEndpointHandlers(); 11 | 12 | app.Run(); 13 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/BindingSource.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal enum BindingSource 4 | { 5 | None = 0, 6 | FromRoute = 1, 7 | FromQuery = 2, 8 | FromHeader = 3, 9 | FromBody = 4, 10 | FromForm = 5, 11 | FromServices = 6, 12 | FromKeyedServices = 7, 13 | AsParameters = 8, 14 | } 15 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "DebugSourceGenerator": { 5 | "commandName": "DebugRoslynComponent", 6 | "targetProject": "..\\..\\tests\\GeneratedEndpoints.Tests.Lab\\GeneratedEndpoints.Tests.Lab.csproj" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | trim_trailing_whitespace = true 6 | end_of_line = lf 7 | insert_final_newline = true 8 | max_line_length = 160 9 | 10 | [*.cs] 11 | indent_style = space 12 | indent_size = 4 13 | 14 | [*.{received,verified}.{txt,xml,json}] 15 | charset = utf-8-bom 16 | end_of_line = lf 17 | indent_size = unset 18 | indent_style = unset 19 | insert_final_newline = false 20 | tab_width = unset 21 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/RequestHandlerAttributeKind.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal enum RequestHandlerAttributeKind 4 | { 5 | None = 0, 6 | ShortCircuit, 7 | DisableValidation, 8 | DisableRequestTimeout, 9 | RequestTimeout, 10 | Order, 11 | MapGroup, 12 | Summary, 13 | Accepts, 14 | ProducesResponse, 15 | RequireAuthorization, 16 | RequireCors, 17 | RequireHost, 18 | RequireRateLimiting, 19 | EndpointFilter, 20 | DisableAntiforgery, 21 | ProducesProblem, 22 | ProducesValidationProblem, 23 | DisplayName, 24 | Description, 25 | AllowAnonymous, 26 | Tags, 27 | ExcludeFromDescription, 28 | } 29 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/DeclarationType.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | /// Specifies the kind of declaration. 4 | public enum DeclarationType 5 | { 6 | /// Represents a namespace declaration. 7 | Namespace = 0, 8 | 9 | /// Represents an interface declaration. 10 | Interface = 1, 11 | 12 | /// Represents a class declaration. 13 | Class = 2, 14 | 15 | /// Represents a record declaration. 16 | Record = 3, 17 | 18 | /// Represents a struct declaration. 19 | Struct = 4, 20 | 21 | /// Represents a record struct declaration. 22 | RecordStruct = 5, 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests.Lab/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "http": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "launchBrowser": false, 8 | "applicationUrl": "http://localhost:5271", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | } 12 | }, 13 | "https": { 14 | "commandName": "Project", 15 | "dotnetRunMessages": true, 16 | "launchBrowser": false, 17 | "applicationUrl": "https://localhost:7127;http://localhost:5271", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/Common/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | using DiffEngine; 2 | using VerifyTests.DiffPlex; 3 | 4 | namespace GeneratedEndpoints.Tests.Common; 5 | 6 | public static class ModuleInitializer 7 | { 8 | private static readonly object Lock = new(); 9 | private static bool _isInitialized; 10 | 11 | public static void Initialize() 12 | { 13 | lock (Lock) 14 | { 15 | if (_isInitialized) 16 | return; 17 | 18 | DiffRunner.Disabled = true; 19 | VerifyDiffPlex.Initialize(OutputType.Compact); 20 | VerifierSettings.InitializePlugins(); 21 | VerifierSettings.ScrubLinesContaining("DiffEngineTray"); 22 | VerifierSettings.IgnoreStackTrace(); 23 | _isInitialized = true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests.Lab/GeneratedEndpoints.Tests.Lab.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net10.0 5 | enable 6 | false 7 | enable 8 | latest 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | appsettings.json 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapGetEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapHeadEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapPatchEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapPostEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapPutEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapQueryEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapTraceEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassEndpointFilter_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ConfigureAddsMetadata_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.CustomFallbackRoute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.DefaultFallbackOnly_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GenericEndpointFilter_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapConnectEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapDeleteEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapOptionsEndpoint_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodEndpointFilter_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodNameCollision_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ConfigureRegistersFilter_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ConfigureWithServiceProvider_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MultipleEndpointNameCollisions_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/RequestHandlerComparer.cs: -------------------------------------------------------------------------------- 1 | namespace GeneratedEndpoints.Common; 2 | 3 | internal sealed class RequestHandlerComparer : IComparer 4 | { 5 | public static RequestHandlerComparer Instance { get; } = new(); 6 | 7 | public int Compare(RequestHandler x, RequestHandler y) 8 | { 9 | var comparison = string.Compare(x.Class.Name, y.Class.Name, StringComparison.Ordinal); 10 | if (comparison != 0) 11 | return comparison; 12 | 13 | comparison = string.Compare(x.Method.Name, y.Method.Name, StringComparison.Ordinal); 14 | if (comparison != 0) 15 | return comparison; 16 | 17 | comparison = string.Compare(x.HttpMethod, y.HttpMethod, StringComparison.Ordinal); 18 | if (comparison != 0) 19 | return comparison; 20 | 21 | return string.Compare(x.Pattern, y.Pattern, StringComparison.Ordinal); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.HttpMethodMatrix_346DFFBCB949_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.HttpMethodMatrix_434E7BEC9B3F_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.HttpMethodMatrix_541EF512DD7F_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.HttpMethodMatrix_DC18F4695C80_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.HttpMethodMatrix_F1EDE56BC773_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_370EBA0910FD_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_50C6E889EAF2_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_517225B7419F_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_61D3AB7FBEBA_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_A7D17F3BAD82_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_25B08C7DE832_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_401A05F2C177_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_A172502B995B_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_B46DF1784969_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_EFC1A0B7E7CE_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/RequestHandlerMethodHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace GeneratedEndpoints.Common; 4 | 5 | internal static class RequestHandlerMethodHelper 6 | { 7 | public static RequestHandlerMethod Create(IMethodSymbol methodSymbol, CancellationToken cancellationToken) 8 | { 9 | cancellationToken.ThrowIfCancellationRequested(); 10 | 11 | var name = methodSymbol.Name; 12 | var isStatic = methodSymbol.IsStatic; 13 | var parameters = methodSymbol.GetParameters(cancellationToken); 14 | var configuration = EndpointConfigurationFactory.Create(methodSymbol); 15 | var requestHandlerMethod = new RequestHandlerMethod 16 | { 17 | Name = name, 18 | IsStatic = isStatic, 19 | Parameters = parameters, 20 | Configuration = configuration, 21 | }; 22 | 23 | return requestHandlerMethod; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.ShortCircuitAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | namespace Microsoft.AspNetCore.Generated.Attributes; 14 | 15 | /// 16 | /// Marks the annotated endpoint or class to short-circuit the request pipeline. 17 | /// 18 | [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 19 | internal sealed class ShortCircuitAttribute : global::System.Attribute 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.DisableAntiforgeryAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | namespace Microsoft.AspNetCore.Generated.Attributes; 14 | 15 | /// 16 | /// Disables antiforgery protection for the annotated endpoint or class. 17 | /// 18 | [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 19 | internal sealed class DisableAntiforgeryAttribute : global::System.Attribute 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.DisableRequestTimeoutAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | namespace Microsoft.AspNetCore.Generated.Attributes; 14 | 15 | /// 16 | /// Disables the request timeout for the annotated endpoint or class. 17 | /// 18 | [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 19 | internal sealed class DisableRequestTimeoutAttribute : global::System.Attribute 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.AsParameters_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.BindingNames_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractTags_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.FromServices_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.AcceptsAttribute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.FromKeyedServices_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_0BE3EC6390D4_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_2F85DF1A025B_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_89F17B97AFD0_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_9F7075874154_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassTags_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractAllowAnonymous_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.DisplayNameAttribute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GroupName_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodTags_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.AcceptsMultipleContentTypes_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.AsyncMethodVariants_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassMapGroup_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireCors_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireHost_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GenericAcceptsAttribute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.OrderMetadata_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesProblemAttribute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesResponseAttribute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequestTimeout_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ShortCircuit_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/AttributeSymbolMatcher.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace GeneratedEndpoints.Common; 4 | 5 | internal static class AttributeSymbolMatcher 6 | { 7 | public static bool IsAttribute(INamedTypeSymbol attributeClass, string attributeName, string[] namespaceParts) 8 | { 9 | var definition = attributeClass.OriginalDefinition; 10 | return definition.Name == attributeName && IsInNamespace(definition.ContainingNamespace, namespaceParts); 11 | } 12 | 13 | public static bool IsInNamespace(INamespaceSymbol? namespaceSymbol, string[] namespaceParts) 14 | { 15 | for (var i = namespaceParts.Length - 1; i >= 0; i--) 16 | { 17 | if (namespaceSymbol is null || namespaceSymbol.Name != namespaceParts[i]) 18 | return false; 19 | 20 | namespaceSymbol = namespaceSymbol.ContainingNamespace; 21 | } 22 | 23 | return namespaceSymbol is null || namespaceSymbol.IsGlobalNamespace; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassAllowAnonymous_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractExcludeFromDescription_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractRequireAuthorization_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.DisableRequestTimeout_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GenericProducesResponseAttribute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodAllowAnonymous_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireCors_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireHost_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequireRateLimiting_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.SummaryAndDescriptionAttributes_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.AuthorizationAndMetadataMatrix_6F94B85A7155_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.AuthorizationAndMetadataMatrix_9D6575ECE261_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassDisableValidation_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireAuthorization_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireCorsWithPolicy_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ExcludeFromDescription_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodDisableValidation_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireAuthorization_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesResponseMultipleContentTypes_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesValidationProblemAttribute_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequestTimeoutWithPolicy_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireCorsWithPolicy_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequireRateLimitingWithPolicy_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_8330CA9A1CFC_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_9F5FE6E1F139_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_DDC9B964FDBC_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_E255BF1E7B54_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.AuthorizationAndMetadataMatrix_257E8A8FA30F_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.AuthorizationAndMetadataMatrix_25B2AC35B582_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.AuthorizationAndMetadataMatrix_4F441534B0BD_AddEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.DependencyInjection.Extensions; 15 | 16 | namespace Microsoft.AspNetCore.Generated.Routing; 17 | 18 | internal static class EndpointServicesExtensions 19 | { 20 | internal static void AddEndpointHandlers(this IServiceCollection services) 21 | { 22 | services.TryAddScoped(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | release: 5 | types: [ published ] 6 | 7 | jobs: 8 | build: 9 | name: Build 10 | runs-on: ubuntu-latest 11 | permissions: 12 | actions: read 13 | contents: read 14 | security-events: write 15 | 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v4 19 | 20 | - name: Setup .NET 10.0 21 | uses: actions/setup-dotnet@v4 22 | with: 23 | dotnet-version: 10.x 24 | 25 | - name: Restore dependencies 26 | run: dotnet restore 27 | 28 | - name: Build 29 | run: dotnet build ./src/GeneratedEndpoints/GeneratedEndpoints.csproj --configuration Release --no-restore 30 | 31 | - name: Pack 32 | run: dotnet pack ./src/GeneratedEndpoints/GeneratedEndpoints.csproj --configuration Release --no-build --output . 33 | 34 | - name: Push to NuGet 35 | run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json 36 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.DisableValidationAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | #if NET10_0_OR_GREATER 2 | //----------------------------------------------------------------------------- 3 | // 4 | // This code was generated by MinimalApiGenerator which can be found 5 | // in the GeneratedEndpoints namespace. 6 | // 7 | // Changes to this file may cause incorrect behavior 8 | // and will be lost if the code is regenerated. 9 | // 10 | //----------------------------------------------------------------------------- 11 | 12 | #nullable enable 13 | 14 | namespace Microsoft.AspNetCore.Generated.Attributes; 15 | 16 | /// 17 | /// Disables request validation for the annotated endpoint or class when targeting .NET 10 or later. 18 | /// 19 | [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 20 | internal sealed class DisableValidationAttribute : global::System.Attribute 21 | { 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_517225B7419F_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | 26 | return builder; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Jean-Sebastien Carle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/develop.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: [ "develop" ] 6 | pull_request: 7 | branches: [ "develop" ] 8 | 9 | jobs: 10 | build: 11 | name: Build 12 | runs-on: ubuntu-latest 13 | permissions: 14 | actions: read 15 | contents: read 16 | security-events: write 17 | 18 | steps: 19 | - name: Checkout repository 20 | uses: actions/checkout@v4 21 | 22 | - name: Initialize CodeQL 23 | uses: github/codeql-action/init@v4 24 | with: 25 | languages: 'csharp' 26 | 27 | - name: Setup .NET 10.0 28 | uses: actions/setup-dotnet@v4 29 | with: 30 | dotnet-version: 10.x 31 | 32 | - name: Restore dependencies 33 | run: dotnet restore 34 | 35 | - name: Build 36 | run: dotnet build --configuration Release --no-restore 37 | 38 | - name: Test 39 | run: dotnet test ./tests/GeneratedEndpoints.Tests/GeneratedEndpoints.Tests.csproj --configuration Release --no-build --verbosity normal --framework net10.0 40 | 41 | - name: Perform CodeQL analysis 42 | uses: github/codeql-action/analyze@v4 43 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_370EBA0910FD_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapFallback(global::FallbackEndpoints.Default) 26 | .WithName("Default"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapGetEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix", global::GeneratedEndpointsTests.HttpMethodEndpoints.Get) 26 | .WithName("Get"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.DefaultFallbackOnly_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapFallback(global::GeneratedEndpointsTests.FallbackEndpoints.Default) 26 | .WithName("Default"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapPostEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapPost("/matrix", global::GeneratedEndpointsTests.HttpMethodEndpoints.Post) 26 | .WithName("Post"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapPutEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapPut("/matrix/{id:int}", global::GeneratedEndpointsTests.HttpMethodEndpoints.Put) 26 | .WithName("Put"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_A7D17F3BAD82_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapFallback("/custom-only", global::FallbackEndpoints.Custom) 26 | .WithName("Custom"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.AsParameters_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.BindingNames_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.FromServices_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.AcceptsAttribute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.FromKeyedServices_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapPatchEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapPatch("/matrix/{id:int}", global::GeneratedEndpointsTests.HttpMethodEndpoints.Patch) 26 | .WithName("Patch"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.CustomFallbackRoute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapFallback("/custom-individual", global::GeneratedEndpointsTests.FallbackEndpoints.Custom) 26 | .WithName("Custom"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapDeleteEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapDelete("/matrix/{id:int}", global::GeneratedEndpointsTests.HttpMethodEndpoints.Delete) 26 | .WithName("Delete"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapHeadEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapMethods("/matrix", new[] { "HEAD" }, global::GeneratedEndpointsTests.HttpMethodEndpoints.Head) 26 | .WithName("Head"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.AcceptsMultipleContentTypes_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapTraceEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapMethods("/matrix", new[] { "TRACE" }, global::GeneratedEndpointsTests.HttpMethodEndpoints.Trace) 26 | .WithName("Trace"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/Common/ScenarioNamer.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Cryptography; 2 | using System.Text; 3 | 4 | namespace GeneratedEndpoints.Tests.Common; 5 | 6 | public static class ScenarioNamer 7 | { 8 | public static string Create(string prefix, params (string Name, object? Value)[] parts) 9 | { 10 | var descriptor = new StringBuilder(); 11 | 12 | foreach (var (name, value) in parts) 13 | { 14 | descriptor.Append(name); 15 | descriptor.Append('='); 16 | descriptor.Append(Sanitize(value)); 17 | descriptor.Append(';'); 18 | } 19 | 20 | using var sha256 = SHA256.Create(); 21 | var bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(descriptor.ToString())); 22 | var hash = Convert.ToHexString(bytes.AsSpan(0, 6)); 23 | return $"{prefix}_{hash}"; 24 | } 25 | 26 | private static string Sanitize(object? value) 27 | { 28 | if (value is null) 29 | return "None"; 30 | 31 | return value switch 32 | { 33 | bool b => b ? "On" : "Off", 34 | string s => s, 35 | _ => value.ToString() ?? "Value", 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapQueryEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapMethods("/matrix/query", new[] { "QUERY" }, global::GeneratedEndpointsTests.HttpMethodEndpoints.Query) 26 | .WithName("Query"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequireRateLimiting_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ConfigureWithServiceProvider_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 26 | .WithName("Handle"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapConnectEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapMethods("/matrix", new[] { "CONNECT" }, global::GeneratedEndpointsTests.HttpMethodEndpoints.Connect) 26 | .WithName("Connect"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MapOptionsEndpoint_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapMethods("/matrix", new[] { "OPTIONS" }, global::GeneratedEndpointsTests.HttpMethodEndpoints.Options) 26 | .WithName("Options"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_50C6E889EAF2_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapFallback("/alternate-fallback", global::GeneratedEndpointsTests.FallbackEndpoints.Custom) 26 | .WithName("Custom"); 27 | 28 | return builder; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractAllowAnonymous_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .AllowAnonymous(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.OrderMetadata_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .WithOrder(7); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ShortCircuit_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .ShortCircuit(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireCors_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireCors(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireCors_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireCors(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassAllowAnonymous_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .AllowAnonymous(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassTags_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .WithTags("Class", "Matrix"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractTags_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .WithTags("Contracts", "Bindings"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodAllowAnonymous_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .AllowAnonymous(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodTags_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .WithTags("Method", "Matrix"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequestTimeout_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .WithRequestTimeout(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractExcludeFromDescription_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .ExcludeFromDescription(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassDisableValidation_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .DisableValidation() 28 | ; 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireHost_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireHost("*.individual.com"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.DisableRequestTimeout_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .DisableRequestTimeout(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.DisplayNameAttribute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .WithDisplayName("Contract endpoint"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ExcludeFromDescription_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .ExcludeFromDescription(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodDisableValidation_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .DisableValidation() 28 | ; 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireCorsWithPolicy_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireCors("ClassPolicy"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ContractRequireAuthorization_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .RequireAuthorization("ContractsPolicy"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireCorsWithPolicy_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireCors("MethodPolicy"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_B46DF1784969_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/configure-filters", global::ConfigureFilterEndpoints.Handle) 26 | .WithName("Handle") 27 | .AddEndpointFilter(); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassRequireAuthorization_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireAuthorization("ClassPolicy"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireAuthorization_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireAuthorization("MethodPolicy"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesProblemAttribute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .ProducesProblem(500, "application/problem+json"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequestTimeoutWithPolicy_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .WithRequestTimeout("TimeoutPolicy"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodRequireHost_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .RequireHost("api.individual.com", "contoso.com"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesValidationProblemAttribute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .ProducesValidationProblem(422, "application/problem+json"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/GeneratedEndpoints/Common/RequestHandler.cs: -------------------------------------------------------------------------------- 1 | using static GeneratedEndpoints.Common.Constants; 2 | 3 | namespace GeneratedEndpoints.Common; 4 | 5 | internal record struct RequestHandler 6 | { 7 | public required RequestHandlerClass Class { get; init; } 8 | public required RequestHandlerMethod Method { get; init; } 9 | public required string HttpMethod { get; init; } 10 | public required string Pattern { get; init; } 11 | 12 | public required string? Name 13 | { 14 | readonly get => _name; 15 | init => _name = value; 16 | } 17 | 18 | private string? _name; 19 | 20 | public void SetFullyQualifiedName() 21 | { 22 | ReadOnlySpan className = Class.Name; 23 | ReadOnlySpan methodName = Method.Name; 24 | 25 | if (className.StartsWith(GlobalPrefix)) 26 | className = className[GlobalPrefix.Length..]; 27 | 28 | var classLen = className.Length; 29 | var methodLen = methodName.Length; 30 | var total = classLen + 1 + methodLen; 31 | 32 | Span buffer = stackalloc char[total]; 33 | className.CopyTo(buffer); 34 | 35 | buffer[classLen] = '.'; 36 | 37 | methodName.CopyTo(buffer[(classLen + 1)..]); 38 | 39 | _name = buffer.ToString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GenericAcceptsAttribute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .Accepts("application/vnd.generic"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesResponseAttribute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .Produces(200, "application/json"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ConfigureAddsMetadata_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Configure( 26 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 27 | .WithName("Handle") 28 | ); 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GenericProducesResponseAttribute_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .Produces(200, "application/json"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ConfigureRegistersFilter_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Configure( 26 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 27 | .WithName("Handle") 28 | ); 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.RequireRateLimitingWithPolicy_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.AspNetCore.RateLimiting; 18 | using Microsoft.Extensions.DependencyInjection; 19 | 20 | namespace Microsoft.AspNetCore.Generated.Routing; 21 | 22 | internal static class EndpointRouteBuilderExtensions 23 | { 24 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 25 | { 26 | builder.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 27 | .WithName("GetMatrix") 28 | .RequireRateLimiting("BurstPolicy"); 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ProducesResponseMultipleContentTypes_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .Produces(200, "application/json", "text/json"); 28 | 29 | return builder; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.SummaryAndDescriptionAttributes_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::GeneratedEndpointsTests.ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .WithSummary("Gets detailed content.") 28 | .WithDescription("Shows binding and contract combinations."); 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_A172502B995B_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | global::ConfigureFilterEndpoints.Configure( 26 | builder.MapGet("/configure-filters", global::ConfigureFilterEndpoints.Handle) 27 | .WithName("Handle") 28 | .AddEndpointFilter() 29 | ); 30 | 31 | return builder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.MapFallbackScenarios_61D3AB7FBEBA_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapFallback("/custom-fallback", global::GeneratedEndpointsTests.FallbackEndpoints.Custom) 26 | .WithName("Custom"); 27 | 28 | builder.MapFallback(global::GeneratedEndpointsTests.FallbackEndpoints.Default) 29 | .WithName("Default"); 30 | 31 | return builder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.OrderAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | namespace Microsoft.AspNetCore.Generated.Attributes; 14 | 15 | /// 16 | /// Specifies the order for the annotated endpoint when building conventions. 17 | /// 18 | [global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 19 | internal sealed class OrderAttribute : global::System.Attribute 20 | { 21 | /// 22 | /// Gets the order that will be applied to the endpoint. 23 | /// 24 | public int Order { get; } 25 | 26 | /// 27 | /// Initializes a new instance of the class. 28 | /// 29 | /// The order value to apply to the endpoint. 30 | public OrderAttribute(int order) 31 | { 32 | Order = order; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.ClassEndpointFilter_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Configure( 26 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 27 | .WithName("Handle") 28 | .AddEndpointFilter() 29 | ); 30 | 31 | return builder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_25B08C7DE832_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 26 | .WithName("Handle") 27 | .AddEndpointFilter() 28 | .AddEndpointFilter(); 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_401A05F2C177_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 26 | .WithName("Handle") 27 | .AddEndpointFilter() 28 | .AddEndpointFilter(); 29 | 30 | return builder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GenericEndpointFilter_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Configure( 26 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 27 | .WithName("Handle") 28 | .AddEndpointFilter() 29 | ); 30 | 31 | return builder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.MethodEndpointFilter_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Configure( 26 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 27 | .WithName("Handle") 28 | .AddEndpointFilter() 29 | ); 30 | 31 | return builder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.SummaryAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | namespace Microsoft.AspNetCore.Generated.Attributes; 14 | 15 | /// 16 | /// Specifies the summary metadata for the annotated endpoint. 17 | /// 18 | [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 19 | internal sealed class SummaryAttribute : global::System.Attribute 20 | { 21 | /// 22 | /// Gets the summary value for the endpoint. 23 | /// 24 | public string Summary { get; } 25 | 26 | /// 27 | /// Initializes a new instance of the class. 28 | /// 29 | /// The summary to apply to the endpoint. 30 | public SummaryAttribute(string summary) 31 | { 32 | Summary = summary; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/IndividualTests.GroupName_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | var _GeneratedEndpointsTests_AuthorizationMatrixEndpoints_Group = builder.MapGroup("") 26 | .WithGroupName("IndividualGroup"); 27 | 28 | _GeneratedEndpointsTests_AuthorizationMatrixEndpoints_Group.MapGet("/matrix/{id:int}", global::GeneratedEndpointsTests.AuthorizationMatrixEndpoints.Handle) 29 | .WithName("GetMatrix"); 30 | 31 | return builder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ConfigureAndFiltersMatrix_EFC1A0B7E7CE_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Configure( 26 | builder.MapGet("/configure-filters", global::GeneratedEndpointsTests.ConfigureFilterEndpoints.Handle) 27 | .WithName("Handle") 28 | .AddEndpointFilter() 29 | ); 30 | 31 | return builder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.RequireHostAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | namespace Microsoft.AspNetCore.Generated.Attributes; 14 | 15 | /// 16 | /// Specifies the allowed hosts for the annotated endpoint or class. 17 | /// 18 | [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 19 | internal sealed class RequireHostAttribute : global::System.Attribute 20 | { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The hosts that are allowed to access the endpoint. 25 | public RequireHostAttribute(params string[] hosts) 26 | { 27 | Hosts = hosts ?? []; 28 | } 29 | 30 | /// 31 | /// Gets the allowed hosts. 32 | /// 33 | public string[] Hosts { get; } 34 | } -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.AuthorizationAndMetadataMatrix_9D6575ECE261_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/matrix/{id:int}", global::AuthorizationMatrixEndpoints.Handle) 26 | .WithName("GetMatrix") 27 | .WithOrder(10) 28 | .WithTags("Class", "Matrix") 29 | .RequireAuthorization("ClassPolicy") 30 | .RequireHost("*.alt.com", "contoso.com") 31 | .ShortCircuit(); 32 | 33 | return builder; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/AttributeGenerationTests.RequireRateLimitingAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | namespace Microsoft.AspNetCore.Generated.Attributes; 14 | 15 | /// 16 | /// Specifies that the annotated endpoint requires the provided rate limiting policy. 17 | /// 18 | [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] 19 | internal sealed class RequireRateLimitingAttribute : global::System.Attribute 20 | { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The rate limiting policy to apply. 25 | public RequireRateLimitingAttribute(string policyName) 26 | { 27 | PolicyName = policyName; 28 | } 29 | 30 | /// 31 | /// Gets the rate limiting policy name. 32 | /// 33 | public string PolicyName { get; } 34 | } -------------------------------------------------------------------------------- /tests/GeneratedEndpoints.Tests/GeneratedSourceTests.ContractsAndBindingMatrix_0BE3EC6390D4_MapEndpointHandlers.verified.txt: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // This code was generated by MinimalApiGenerator which can be found 4 | // in the GeneratedEndpoints namespace. 5 | // 6 | // Changes to this file may cause incorrect behavior 7 | // and will be lost if the code is regenerated. 8 | // 9 | //----------------------------------------------------------------------------- 10 | 11 | #nullable enable 12 | 13 | using Microsoft.AspNetCore.Builder; 14 | using Microsoft.AspNetCore.Http; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.AspNetCore.Routing; 17 | using Microsoft.Extensions.DependencyInjection; 18 | 19 | namespace Microsoft.AspNetCore.Generated.Routing; 20 | 21 | internal static class EndpointRouteBuilderExtensions 22 | { 23 | internal static IEndpointRouteBuilder MapEndpointHandlers(this IEndpointRouteBuilder builder) 24 | { 25 | builder.MapGet("/contracts/{id:int}", global::ContractEndpoints.Handle) 26 | .WithName("Handle") 27 | .WithDisplayName("Contract endpoint") 28 | .WithTags("Contracts", "Bindings") 29 | .Produces(200, "application/problem+json") 30 | .ProducesProblem(500, "application/problem+json") 31 | .AllowAnonymous(); 32 | 33 | return builder; 34 | } 35 | } 36 | --------------------------------------------------------------------------------