Class EndpointOptions
endpoint registration options
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public sealed class EndpointOptions
Properties
AllowEmptyRequestDtos
allows the use of empty request dtos
Declaration
public bool AllowEmptyRequestDtos { set; }
Property Value
Type | Description |
---|---|
bool |
Configurator
a configuration action to be performed on each endpoint definition during startup.
some of the same methods you use inside Configure()
method are available to be called on the EndpointDefinition
parameter.
this can be used to apply a set of common configuration settings globally to all endpoints.
i.e. apply globally applicable settings here and specify only the settings applicable to individual endpoints from within each endpoints'
Configure()
method.
app.UseFastEndpoints(c => c.Configurator = ep =>
{
ep.AllowAnonymous();
ep.Description(b => b.Produces<ErrorResponse>(400));
});
Declaration
public Action<EndpointDefinition>? Configurator { set; }
Property Value
Type | Description |
---|---|
Action<EndpointDefinition> |
Filter
a function to filter out endpoints from auto registration. the function you set here will be executed for each endpoint during startup. you can inspect the EndpointSettings to check what the current endpoint is, if needed. return 'false' from the function if you want to exclude an endpoint from registration. return 'true' to include. this function will executed for each endpoint that has been discovered during startup.
Declaration
public Func<EndpointDefinition, bool>? Filter { set; }
Property Value
Type | Description |
---|---|
Func<EndpointDefinition, bool> |
NameGenerator
specify a function to customize the endpoint name/swagger operation id. generate an endpoint name however you wish and return a string from your function. all available info for name generation is supplied via the EndpointNameGenerationContext.
Declaration
public Func<EndpointNameGenerationContext, string> NameGenerator { set; }
Property Value
Type | Description |
---|---|
Func<EndpointNameGenerationContext, string> |
PrefixNameWithFirstTag
set to true if you'd like to automatically prefix endpoint name (swagger operation id) with the first endpoint tag.
the generated the operation id would be in the form of: MyTag_CreateOrderEndpoint
. this should come in handy with generating separate api clients
with nswag using the "MultipleClientsFromOperationId" setting which requires operation ids to be have a group name prefix with an underscore.
Declaration
public bool PrefixNameWithFirstTag { set; }
Property Value
Type | Description |
---|---|
bool |
RoutePrefix
prefix for all routes (example 'api').
Declaration
public string? RoutePrefix { set; }
Property Value
Type | Description |
---|---|
string |
ShortNames
set to true if you'd like the endpoint names/ swagger operation ids to be just the endpoint class names instead of the full names including namespace.
Declaration
public bool ShortNames { set; }
Property Value
Type | Description |
---|---|
bool |