rest-vir - v2.2.0
    Preparing search index...

    Type Alias BaseCommonRouteDefinition

    type BaseCommonRouteDefinition = {
        clientOriginRequirement?: OriginRequirement;
        searchParams?: Readonly<Record<string, SearchParamRequirement>>;
    }
    Index

    Properties

    clientOriginRequirement?: OriginRequirement

    The client origin requirement for this route. If this is undefined or omitted, the api's overall client origin requirement is fallen back to.

    searchParams?: Readonly<Record<string, SearchParamRequirement>>

    Search params that this route supports.

    • Omit or set to undefined to disable search params checking (the route will then accept arbitrary search params on the URL without validation).

    • Set to an object to declare the search params this route expects. Each key's value picks how the search param value is parsed and validated:

      • A Shape whose runtime type is a single string (e.g. defineShape('')): the URL must carry exactly one occurrence of the key.
      • A Shape whose runtime type is string[] (e.g. defineShape([''])): the URL must carry one or more occurrences. A single occurrence is auto-wrapped into a one-element array.
      • A Shape whose runtime type is string | string[]: both URL forms are accepted. The value is passed through as-is.
      • A single RegExp: the URL must carry exactly one occurrence. The value is tested against the regex.
      • An array of RegExp (e.g. [/^\d+$/, /^[a-z]+$/]): the URL must carry one or more occurrences. Each value must match at least one of the supplied regexes (any regex in the array may match. The position of the regex in the array is not significant).

    Whether a key is required is driven by its shape: a non-nullable shape is required, a nullable shape (e.g. nullableShape(...)) is optional. RegExp requirements are always required. See RouteSearchParamsType for the derived TypeScript type.