Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
ceec319
Add support for Configure method. (#3)
jscarle Nov 15, 2025
a8836ba
Support service provider aware Configure methods (#5)
jscarle Nov 15, 2025
4128143
Add MapGetWithConfigure test (#6)
jscarle Nov 15, 2025
7d77efd
Add MapQuery attribute support (#7)
jscarle Nov 15, 2025
9ed0d27
Add AllowAnonymous attribute handling (#8)
jscarle Nov 15, 2025
f21df5d
Support generic Accepts and Produces attributes (#9)
jscarle Nov 15, 2025
1e97f83
Expand lab GetUser endpoint metadata (#10)
jscarle Nov 15, 2025
778c813
docs: expand README coverage (#11)
jscarle Nov 15, 2025
b7628f6
Add comprehensive generator test coverage (#12)
jscarle Nov 15, 2025
b87a36b
Fixed scope.
jscarle Nov 15, 2025
be9a365
Use built-in AllowAnonymous attribute (#13)
jscarle Nov 15, 2025
1a3fd3a
Rename Produces attribute to ProducesResponse (#14)
jscarle Nov 15, 2025
6c701ad
Propagate exclude from description metadata (#15)
jscarle Nov 15, 2025
b0d0762
Fixed namespace.
jscarle Nov 15, 2025
1dfa196
Allow specifying produces response type via named parameter (#16)
jscarle Nov 15, 2025
d14bffe
Fix tests.
jscarle Nov 15, 2025
9345004
Allow AcceptsAttribute request type named argument (#17)
jscarle Nov 15, 2025
198bb80
Allow null response type for non-generic attribute (#18)
jscarle Nov 15, 2025
5375c9b
Add IsOptional support to AcceptsAttribute (#19)
jscarle Nov 15, 2025
fec8a29
Cleanup.
jscarle Nov 15, 2025
90a34fd
Pin to .NET 10.
jscarle Nov 15, 2025
c09a408
Clarify README usage details (#20)
jscarle Nov 15, 2025
b02c980
docs: expand and clarify README (#21)
jscarle Nov 15, 2025
5b32db8
Refactor HTTP attribute definitions (#22)
jscarle Nov 15, 2025
bb4f3ab
Fix AllowAnonymous override with method RequireAuthorization (#23)
jscarle Nov 15, 2025
c666e4e
Simplify endpoint handler buffer estimate (#25)
jscarle Nov 15, 2025
238c76c
Use symbol metadata for attribute detection (#26)
jscarle Nov 15, 2025
11615fd
Cleanup.
jscarle Nov 15, 2025
a91cb96
Fixed FromKeyedServices.
jscarle Nov 15, 2025
7c3a82b
Muted warnings.
jscarle Nov 15, 2025
ff8b8c1
Preserve binding attribute names (#27)
jscarle Nov 15, 2025
18a6dfe
Restrict metadata attributes to methods (#28)
jscarle Nov 15, 2025
6b072fb
Add RequireCors and rate limiting support (#29)
jscarle Nov 15, 2025
ae9f2b3
Strip global prefix from fully qualified endpoint names (#30)
jscarle Nov 15, 2025
0754480
Add support for EndpointFilter attributes (#31)
jscarle Nov 15, 2025
dcac359
Add short circuit and request timeout attributes (#32)
jscarle Nov 15, 2025
54fa01f
Add MapFallback endpoint support (#33)
jscarle Nov 15, 2025
4bae24a
Add support for WithOrder attribute (#34)
jscarle Nov 15, 2025
54e4ee1
Add DisplayName metadata support (#35)
jscarle Nov 15, 2025
7f36a10
Add WithGroupName attribute support (#36)
jscarle Nov 15, 2025
7f1ea4c
Add RequireHost endpoint metadata support (#37)
jscarle Nov 15, 2025
838454f
Fixed double escape.
jscarle Nov 16, 2025
c039997
Rename custom attributes to avoid With prefix (#38)
jscarle Nov 16, 2025
06185ba
Use component model display metadata attributes (#39)
jscarle Nov 16, 2025
5bbe092
Cleanup.
jscarle Nov 16, 2025
75f10b5
Add Summary attribute and rename metadata attributes (#40)
jscarle Nov 16, 2025
8d3c4c6
Cleanup.
jscarle Nov 16, 2025
d45f1e2
Remove generated tests and readme.
jscarle Nov 16, 2025
907883b
Add individual generator coverage (#41)
jscarle Nov 16, 2025
bfd281d
Cleanup tests.
jscarle Nov 16, 2025
f2c8b7e
Expand README with usage guide (#42)
jscarle Nov 16, 2025
dd07b2d
Fixed readme.
jscarle Nov 16, 2025
99e706c
Document MapGroup attribute (#43)
jscarle Nov 16, 2025
ea1b061
Add group name support to MapGroup attribute (#44)
jscarle Nov 16, 2025
020accf
Cleanup.
jscarle Nov 16, 2025
591d1b1
Add DisableValidation attribute support (#45)
jscarle Nov 16, 2025
5692a0e
Fixed preprocessor directive.
jscarle Nov 16, 2025
f1e2c09
Fix readme.
jscarle Nov 16, 2025
273c7ba
Docs: reformat attribute reference (#46)
jscarle Nov 16, 2025
ab86fae
Optimize generator hot paths (#47)
jscarle Nov 16, 2025
c7acecb
Optimize source generator hot paths (#48)
jscarle Nov 16, 2025
1b00c2d
Optimize generator attribute handling (#49)
jscarle Nov 16, 2025
332867b
Improve generator performance with aggressive caching (#50)
jscarle Nov 16, 2025
1363b94
Optimize source generator performance (#51)
jscarle Nov 16, 2025
fc4bc3e
Add tests for attribute generation (#52)
jscarle Nov 16, 2025
271a5cd
Add async method variant tests (#53)
jscarle Nov 16, 2025
3d1ab44
Optimize generator performance (#54)
jscarle Nov 16, 2025
b8e1968
Cleanup.
jscarle Nov 16, 2025
e3e8f3a
Optimize source generator performance (#55)
jscarle Nov 16, 2025
1a4cbc7
Cleanup.
jscarle Nov 16, 2025
14418cb
Refactor MinimalApiGenerator into partial files (#56)
jscarle Nov 16, 2025
e04d2ae
Cleanup.
jscarle Nov 16, 2025
23e7dd3
Cleanup.
jscarle Nov 16, 2025
d1a1985
Optimize parameter binding detection (#57)
jscarle Nov 16, 2025
b916f58
Add cancellation checks to source generation context (#58)
jscarle Nov 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
contents: read
security-events: write

strategy:
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -27,10 +24,10 @@ jobs:
with:
languages: 'csharp'

- name: Setup .NET 9.0
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
dotnet-version: 10.x

- name: Restore dependencies
run: dotnet restore
Expand All @@ -39,7 +36,7 @@ jobs:
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test ./tests/GeneratedEndpoints.Tests/GeneratedEndpoints.Tests.csproj --configuration Release --no-build --verbosity normal --framework net9.0
run: dotnet test ./tests/GeneratedEndpoints.Tests/GeneratedEndpoints.Tests.csproj --configuration Release --no-build --verbosity normal --framework net10.0

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
7 changes: 2 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ jobs:
contents: read
security-events: write

strategy:
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET 9.0
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
dotnet-version: 10.x

- name: Restore dependencies
run: dotnet restore
Expand Down
7 changes: 7 additions & 0 deletions GeneratedEndpoints.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneratedEndpoints.Tests",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneratedEndpoints", "src\GeneratedEndpoints\GeneratedEndpoints.csproj", "{2F54865E-0F46-416B-A18D-C6C2ACF912B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneratedEndpoints.Tests.Lab", "tests\GeneratedEndpoints.Tests.Lab\GeneratedEndpoints.Tests.Lab.csproj", "{2E39D0D0-B4C7-4A28-94E0-067E3B0902E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -20,8 +22,13 @@ Global
{2F54865E-0F46-416B-A18D-C6C2ACF912B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F54865E-0F46-416B-A18D-C6C2ACF912B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F54865E-0F46-416B-A18D-C6C2ACF912B2}.Release|Any CPU.Build.0 = Release|Any CPU
{2E39D0D0-B4C7-4A28-94E0-067E3B0902E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E39D0D0-B4C7-4A28-94E0-067E3B0902E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E39D0D0-B4C7-4A28-94E0-067E3B0902E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E39D0D0-B4C7-4A28-94E0-067E3B0902E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{01E8E43A-EA5C-4F28-BAAE-A3EB7861B57E} = {F1E3D1D7-B9E4-4EFF-8FD5-2A735A4695B4}
{2E39D0D0-B4C7-4A28-94E0-067E3B0902E2} = {F1E3D1D7-B9E4-4EFF-8FD5-2A735A4695B4}
EndGlobalSection
EndGlobal
208 changes: 115 additions & 93 deletions README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "10.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
2 changes: 1 addition & 1 deletion src/GeneratedEndpoints/Common/EquatableImmutableArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public static EquatableImmutableArray<T> ToEquatableImmutableArray<T>(this Immut
/// <returns>An <see cref="EquatableImmutableArray{T}"/> containing the same elements as the original enumerable.</returns>
public static EquatableImmutableArray<T> ToEquatableImmutableArray<T>(this IEnumerable<T> enumerable)
{
return new EquatableImmutableArray<T>(enumerable.ToImmutableArray());
return new EquatableImmutableArray<T>([..enumerable]);
}
}
46 changes: 46 additions & 0 deletions src/GeneratedEndpoints/Common/StringBuilderPool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Text;

namespace GeneratedEndpoints.Common;

/// <summary>Provides a simple per-thread cache for <see cref="StringBuilder"/> instances.</summary>
internal static class StringBuilderPool
{
private const int MaxBuilderCapacity = 128 * 1024;

[ThreadStatic]
private static StringBuilder? _cachedInstance;

/// <summary>Gets a <see cref="StringBuilder"/> with at least the requested capacity.</summary>
public static StringBuilder Get(int capacity = 16)
{
var builder = _cachedInstance;
if (builder is null)
return new StringBuilder(capacity);

_cachedInstance = null;
builder.Clear();
if (builder.Capacity < capacity)
builder.EnsureCapacity(capacity);

return builder;
}

/// <summary>Returns the <see cref="StringBuilder"/> to the pool if it is below the maximum retention size.</summary>
public static void Return(StringBuilder builder)
{
if (builder.Capacity > MaxBuilderCapacity)
return;

builder.Clear();
if (_cachedInstance is null)
_cachedInstance = builder;
}

/// <summary>Converts the builder to a string and returns it to the pool.</summary>
public static string ToStringAndReturn(StringBuilder builder)
{
var result = builder.ToString();
Return(builder);
return result;
}
}
186 changes: 0 additions & 186 deletions src/GeneratedEndpoints/Common/TypeSymbolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,194 +2,8 @@

namespace GeneratedEndpoints.Common;

/// <summary>Provides extension methods for working with type symbols.</summary>
internal static class TypeSymbolExtensions
{
public static bool IsFromRouteAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "FromRouteAttribute",
ContainingNamespace:
{
Name: "Mvc",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsFromQueryAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "FromQueryAttribute",
ContainingNamespace:
{
Name: "Mvc",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsFromHeaderAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "FromHeaderAttribute",
ContainingNamespace:
{
Name: "Mvc",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsFromBodyAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "FromBodyAttribute",
ContainingNamespace:
{
Name: "Mvc",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsFromFormAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "FromFormAttribute",
ContainingNamespace:
{
Name: "Mvc",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsFromServicesAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "FromServicesAttribute",
ContainingNamespace:
{
Name: "Mvc",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsFromKeyedServicesAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "FromKeyedServicesAttribute",
ContainingNamespace:
{
Name: "Mvc",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsAsParametersAttribute(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "AsParametersAttribute",
ContainingNamespace:
{
Name: "Http",
ContainingNamespace:
{
Name: "AspNetCore",
ContainingNamespace:
{
Name: "Microsoft",
ContainingNamespace.IsGlobalNamespace: true,
},
},
},
};
}

public static bool IsCancellationToken(this ITypeSymbol symbol)
{
return symbol is INamedTypeSymbol
{
MetadataName: "CancellationToken",
ContainingNamespace:
{
Name: "Threading",
ContainingNamespace:
{
Name: "System",
ContainingNamespace.IsGlobalNamespace: true,
},
},
};
}

public static bool IsValueTask(this ITypeSymbol symbol, out INamedTypeSymbol valueTaskSymbol)
{
if (symbol is INamedTypeSymbol
Expand Down
8 changes: 4 additions & 4 deletions src/GeneratedEndpoints/GeneratedEndpoints.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<!-- References -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" PrivateAssets="all" />
<PackageReference Include="PolySharp" Version="1.15.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -36,9 +36,9 @@
<!-- Output -->
<PropertyGroup>
<AssemblyName>GeneratedEndpoints</AssemblyName>
<Version>9.0.0-preview.1</Version>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<FileVersion>9.0.0.0</FileVersion>
<Version>10.0.0</Version>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<FileVersion>10.0.0.0</FileVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>
Expand Down
Loading
Loading