Theia API Documentation v1.76.0
    Preparing search index...

    Options of a typed route, see ExternalApiRouter.

    interface RestRouteOptions<B = undefined> {
        bodySchema?: RestBodySchema<B>;
        description?: string;
        jsonLimit?: string;
        operationId?: string;
        params?: Record<string, RestParamDocumentation>;
        responses?: Record<number, RestResponseDocumentation>;
        summary?: string;
        validate?: (body: B) => undefined | string;
    }

    Type Parameters

    • B = undefined

    Hierarchy (View Summary)

    Index

    Properties

    bodySchema?: RestBodySchema<B>

    JSON Schema of the request body. When declared, the request body is parsed as JSON and validated against the schema. Violations are rejected with a client error carrying the validation messages as details, without invoking the handler, and the schema is published in the OpenAPI document.

    The body must be sent with a Content-Type: application/json header; without it the body is not parsed and the request is rejected as if it were empty.

    description?: string

    Longer description of the route; CommonMark.

    jsonLimit?: string

    JSON body size limit of this route, e.g. '2mb'. Defaults to '1mb'. Only used together with bodySchema.

    operationId?: string

    Stable operation id, unique across the external API, e.g. createChatSession.

    params?: Record<string, RestParamDocumentation>

    Documentation of the route's path parameters, e.g. of id for a route registered on /:id.

    responses?: Record<number, RestResponseDocumentation>

    Documented responses of the route by status code. Declarative documentation only, not enforced.

    summary?: string

    Short summary of what the route does.

    validate?: (body: B) => undefined | string

    Additional validation for constraints the bodySchema cannot express, such as cross-field dependencies, running on the schema-valid body. Returns undefined (or an empty string) when the body is valid, otherwise the error message the request is rejected with. Only used together with bodySchema.