Function checkRequestValidation

Determines request schema validation results and conceptually returns one of three states: valid, invalid (soft validation error), or invalid (hard validation error). For invalid cases, additional metadata is included in the result.

  • Parameters

    • __namedParameters: {
          reqBody: SerializationResult | DeserializationResult<any>;
          reqHeaders:
              | SerializationResult
              | DeserializationResult<Partial<AnyHeaders>>;
          reqParams: SerializationResult | DeserializationResult<Partial<AnyParams>>;
          reqQuery: SerializationResult | DeserializationResult<Partial<AnyQuery>>;
          validationMode: ValidationMode;
      }

    Returns
        | (
            { ok: true; } & ({ hadSoftValidationError: false; invalidPart?: undefined; validationError?: undefined; validationErrorPath?: undefined; } | { hadSoftValidationError: true; invalidPart: "headers" | "params" | "query" | "body"; validationError: string; validationErrorPath: string; })
        )
        | {
            invalidPart: "headers"
            | "params"
            | "query"
            | "body";
            ok: false;
            validationError: string;
            validationErrorPath: string;
        }