Skip to main content

Registration, generation, and diagnostics

Default discovery

AddValiantEndpoints() registers generated route registrars from the calling and entry assemblies. MapValiantEndpoints() resolves every registered registrar.

Explicit assemblies

Use explicit overloads when endpoints live in feature libraries:

builder.Services.AddValiantEndpoints(
typeof(OrdersEndpoint).Assembly,
typeof(BillingEndpoint).Assembly);

app.MapValiantEndpoints();

Explicit assembly selection changes registration only. Endpoint mapping always uses the same MapValiantEndpoints() entry point, so generated mapping policy and conventions have one consistent execution path.

Generator scope

The incremental generator starts from marker attributes—not an assembly-wide interface scan:

  • [ValiantEndpoint] or [ValiantEndpoint<TGroup>] generates endpoint registration;
  • [ValiantEndpointGroup] generates group registration;
  • partial query request/type declarations receive binders only when query binding is explicitly enabled and they are referenced from generated endpoint methods.

The companion analyzer checks only direct IEndpoint and IEndpointGroup declarations for missing markers. It intentionally avoids indirect and aliased implementation scans to keep IDE analysis bounded.

IEndpointGroup.CreateGroup is a static abstract interface member. The C# compiler requires every endpoint group type to provide a public static implementation.

Diagnostics

IDMeaning
VLE001Marked endpoint does not implement IEndpoint
VLE002A declaration implements both endpoint interfaces
VLE003Endpoint marker was applied to a group
VLE004Declared group type does not implement IEndpointGroup
VLE005Marked group does not implement IEndpointGroup
VLE006Direct endpoint declaration is missing [ValiantEndpoint]
VLE007Direct group declaration is missing [ValiantEndpointGroup]
VLE008Group marker was applied to an endpoint
VLE009An endpoint uses more than one endpoint marker form
VLE010A query type cannot receive the generated binder

VLE010 covers shapes such as non-partial source types, static types, open generics, or containing types that cannot receive generated members.