Path: redb-route/redb.Route.Http/Rest/RestOptions.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Http/Rest/RestOptions.cs
----
namespace redb.Route.Http.Rest;
/// How request and response bodies are bound to CLR types by the REST DSL.
public enum RestBindingMode
{
/// Bodies stay as the HTTP consumer delivers them (byte[] in, whatever the route leaves out).
Off,
/// A verb with Type<T>() gets its request body unmarshalled from JSON to T; a non-text response body is marshalled to JSON.
Json,
}
///
/// Settings of one Rest(...) declaration: where the routes listen, default binding and media
/// types, and the OpenAPI document.
///
public sealed class RestOptions
{
/// Bind host of the shared HTTP server. Default 0.0.0.0.
public string Host { get; set; } = "0.0.0.0";
/// Bind port. Default 8080. Several Rest(...) declarations may share a port.
public int Port { get; set; } = 8080;
/// Default binding mode of the verbs; a verb can override it. Default .
public RestBindingMode BindingMode { get; set; } = RestBindingMode.Off;
/// Default request media type expected by the verbs (application/json); a verb can override it.
public string? Consumes { get; set; }
/// Default response media type of the verbs; a verb can override it.
public string? Produces { get; set; }
/// Serve the generated OpenAPI 3.0 document. Default true.
public bool OpenApi { get; set; } = true;
/// Path of the OpenAPI document on the same host and port; null = {basePath}/openapi.json, so several declarations on one port do not collide.
public string? OpenApiPath { get; set; }
/// OpenAPI info.title.
public string Title { get; set; } = "redb.Route API";
/// OpenAPI info.version.
public string Version { get; set; } = "1.0.0";
///
/// Validate client requests before the route runs, like Camel's clientRequestValidation:
/// an Accept that excludes the produced type is answered with 406, a missing required or
/// non-convertible declared parameter with 400. A verb can override it. Default false:
/// parameters declared for the OpenAPI document alone never start refusing requests.
/// The 415 check of Consumes runs either way.
///
public bool ClientRequestValidation { get; set; }
///
/// Registry name of an that writes the body of a refused
/// request (415, 406, 400), #name or name. It finds the code, reason and parameter in
/// . A name that is not registered fails when the routes start.
/// null = the reason as text/plain.
///
public string? ErrorHandler { get; set; }
///
/// How the callers of every route of this declaration prove who they are (the http: consumer's inboundAuth):
/// Basic with / , Bearer with the registered
/// validator named by . A refused request gets 401 before the route runs. The OpenAPI
/// document is behind the same check. Default None.
///
public HttpAuthScheme InboundAuth { get; set; } = HttpAuthScheme.None;
/// User name InboundAuth=Basic accepts.
public string? InboundUsername { get; set; }
/// Password InboundAuth=Basic accepts; take it from configuration ({{…}}).
public string? InboundPassword { get; set; }
/// Realm named in WWW-Authenticate; null = the consumer's default.
public string? InboundRealm { get; set; }
/// Registry name of the for InboundAuth=Bearer.
public string? TokenValidator { get; set; }
/// Extra query parameters appended to every generated consumer URI ("ssl=true&sslCertPath=..."), for options the DSL does not model.
public string? ExtraConsumerOptions { get; set; }
}