.okf/generated-code.md
Src/Generator)| Generator | Purpose |
|---|---|
DiscoveredTypesGenerator | Emits discovered endpoint/handler/validator/etc. type lists (DiscoveredTypes) for AOT-friendly AddFastEndpoints |
AccessControlGenerator | Permission constants/groups from AccessControl(...) calls; category args resolve as string literals or compile-time string constants (const, nameof, etc.) via semantic model |
ReflectionGenerator | Reflection cache support for reduced runtime reflection |
ServiceRegistrationGenerator | DI registration from attributes |
GenericProcessorTypesGenerator | Generic pre/post processor type materialization |
Whitelist for discovery includes IEndpoint, IEventHandler, ICommandHandler, stream command handlers, summaries, job storage providers, processors, command middleware, mappers, FluentValidation validators (DiscoveredTypesGenerator).
FastEndpoints.Generator.targets: when GenerateSerializerContexts=true, runs Generator.Cli to emit STJ serializer contexts into SerializerContextOutputPath (default Generated/FastEndpoints).ExportOpenApiArtifactsBeforeAotPublish exports .json/.http when ExportOpenApiDocs/ExportHttpFiles set (aliases keep old target names). Single JIT intermediate dir + combined CLI flags when both enabled; app one-call export orchestrator (ExportOpenApiArtifactsAndExitAsync) reads those flags (see NativeAotChecker).FastEndpoints.Generator.Cli.dll; package mode installs local tool FastEndpoints.Generator.Cli.Generated/ foldersGenerated/, wwwroot/openapi/, publish aot/ (gitignored)Prefer changing generator sources under Src/Generator/*.cs or targets, then rebuild.
Harness example:
<ProjectReference Include="..\..\Src\Generator\FastEndpoints.Generator.csproj"
OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
And AddFastEndpoints(DiscoveredTypes.All) in Program.cs.
Src/Generator/DiscoveredTypesGenerator.csSrc/Generator/FastEndpoints.Generator.csprojSrc/Generator/FastEndpoints.Generator.targetsTestHarness/Web/Web.csprojTestHarness/NativeAotChecker/NativeAotChecker.csproj