Header menu logo Falco.UnionRoutes

FieldParser Type

Registers a parser for a custom type in route/query parameters.

Create with Extractor.parser, Extractor.constrainedParser, or Extractor.typedParser. Only needed for custom types — built-in types (Guid, string, int, int64, bool) and single-case DU wrappers are handled automatically.

InputType determines how values are fed to the parser: typeof<string> for string parsers, or a typed input (e.g., typeof<bool>) for typed parsers. ExplicitConstraints adds ASP.NET Core route constraints at endpoint registration.

Example

 let config: EndpointConfig<AppError> = {
     Parsers = [
         Extractor.constrainedParser<Slug> [| RouteConstraint.Alpha |] (fun s -> Ok (Slug s))
     ]
     // ... other config
 }
val config: 'a
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>

Record fields

Record Field Description

ExplicitConstraints

Full Usage: ExplicitConstraints

Field type: RouteConstraint[]

Explicit route constraints declared by this parser (e.g., [| Alpha |])

Field type: RouteConstraint[]

ForType

Full Usage: ForType

Field type: Type

The output type this parser produces (e.g., typeof)

Field type: Type

InputType

Full Usage: InputType

Field type: Type

The input type the parser expects (typeof for plain parsers, typeof for typed, etc.)

Field type: Type

Parse

Full Usage: Parse

Field type: obj -> Result<obj, string>

Parse input value (boxed InputType) into the target type

Field type: obj -> Result<obj, string>

Type something to start searching.