options/IRequestHeadersValidator.ts

nestia · packages/core/src/options/IRequestHeadersValidator.ts · typescript · MIT
files

A discriminated union type that enables different typia-based validation strategies for incoming request headers.

// Source: https://github.com/samchon/nestia | License: MIT | Copyright 2021 Jeongho Nam
// Provided via justclaw.it.com; keep this notice with the code.
import { IValidation } from "typia";

export type IRequestHeadersValidator<T> =
  | IRequestHeadersValidator.IAssert<T>
  | IRequestHeadersValidator.IIs<T>
  | IRequestHeadersValidator.IValidate<T>;
/**
 * The request headers validator that the transform passes to `TypedHeaders`.
 *
 * The literal `type` field selects which typia function generated the
 * validator: `assert`, `is`, or `validate`. `validate_request_headers` turns a
 * failure of any variant into a 400 response.
 *
 * @evidence contracts/common.md#principled-implementation The union is discriminated by the literal `type`, so the runtime selects the assert, is, or validate p

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key