Class RestDefinition
REST DSL (Apache Camel rest() parity) on top of the HTTP consumer and the shared Kestrel host:
every verb becomes an ordinary route From("http://host:port/base/path?methods=GET&inOut=true"),
so path templates, method dispatch (405), CORS, TLS and everything else stay where they already are.
The DSL adds the declarative layer: path parameters as header.id, query as header.query.page,
Consumes / Produces with 415 on mismatch, JSON binding to CLR types, and an OpenAPI 3.0
document generated from the declarations.
this.Rest("/api/orders", o => o.Port = 8080)
.Get("/{id}").To("direct:get-order")
.Post().Consumes("application/json").Type<Order>().To("direct:create-order")
.Put("/{id}/status").To("direct:set-status")
.Delete("/{id}").To("direct:cancel-order");
public sealed class RestDefinition
Inheritance
Properties
OpenApiPath
Path the OpenAPI document is served at ( or {basePath}/openapi.json).
public string OpenApiPath { get; }
Verbs
Verbs declared so far (completed with To / Route).
public IReadOnlyList<RestVerbDefinition> Verbs { get; }