ulo
ulo
Documentation

Start here

Coming from NestJSNestJS topics, mapped

The model

ExtractorsBuilt-in ExtractorsValidationCustom ExtractorsMultipart

Protocols

Integrations

Operating

Reference

Extractors

Extractors

Handler parameters that read the call, checked when the application is built.

An extractor is a handler parameter whose type says what to read from the call. Path<u32> parses a route segment, Json<T> deserialises a body, Multipart streams an upload. The generated handler extracts every parameter in order, then builds the controller, then runs the method. A failed extraction builds no per-execution controller (a controller built once per call, see Scopes) and answers an error before the handler body runs, so the body never validates its own inputs.

A parameter comes from one of two places:

  • From the call: types that implement FromCall<T> for a transport T. The HTTP ones are in this chapter and are imported from ulo_http.
  • From the container: Dep<T>, Ext<T>, ExecutionRef and the other injection-point types. They are accepted on every transport; see Core Concepts.

One rule governs the body: a request has one, and only one extractor may read it. Each type declares whether it consumes the body, and the macro checks every pair of parameters at compile time, naming both in the error. An alias such as type Body<T> = Json<T> is checked as the type it names.

FromCall is generic over the transport, so the same shape extracts an RPC payload or a WebSocket frame; Custom Extractors shows one written for HTTP. The examples for this chapter are examples/15-http-requests and examples/19-http-uploads.

Built-in Extractors

Path, Query, Json, Form, Header, Bytes, BodyStream, and what each does when the call does not fit.

Validation

Valid<P> and the rules that turn a decoded value into a 422.

Custom Extractors

Implementing FromCall for a type of your own, and failing with the right error.

Multipart

Streaming uploads under a server body limit and a per-route one.

Error Handling

Classified domain errors, the problem-details body, and the error handlers that can claim, pass on or reshape an error.

Built-in Extractors

The HTTP extractors, what each reads, and the status each answers when the call does not fit.