import type { TSchema } from '@sinclair/typebox'; /** * Per-content-type body entry. May be: * - a TypeBox schema (validated, no example) * - `true` (any body accepted, no validation) * - an object with optional `schema` (TSchema | true), `example`, `examples` * (forwarded to the OpenAPI media type object) */ export type BodyEntryConfig = { schema?: TSchema | true; example?: unknown; examples?: Record; }; export type BodyEntry = TSchema | true | BodyEntryConfig; /** * Body validation can either be: * - a TypeBox schema (treated as `application/json` for backwards compatibility) * - a record mapping content-type strings to a `BodyEntry`. Content-type * keys may include wildcards: `text/*`, `application/*`, or `* / *`. */ export type BodyValidation = TBody | Record; /** * Normalized internal representation: every entry has the expanded * `BodyEntryConfig` shape with `schema` always set (defaulting to `true`). */ export type NormalizedBody = Record> & BodyEntryConfig>; /** * Detect whether a given value is a TypeBox schema. TypeBox attaches a * `[Kind]` symbol to every schema instance which is what we use to * distinguish a schema from a content-type-keyed body record. */ export declare function isTSchema(value: unknown): value is TSchema; /** * Normalize the body option into a `NormalizedBody` map. A bare TypeBox * schema is mapped to `application/json` for backwards compatibility. */ export declare function normalizeBody(body: TSchema | Record | undefined): NormalizedBody | undefined; /** * Match an incoming content-type against a normalized body map, honoring * wildcard entries like `text/*` or `*\/*`. Exact matches always win. */ export declare function matchContentType(incoming: string, normalized: NormalizedBody): string | undefined; export type RequestValidation = { private?: boolean; deprecated?: boolean; /** * OpenAPI Security Requirement Objects for this operation. Overrides the * document level `security` array - entries are alternatives (OR) and the * keys must reference `components.securitySchemes` */ security?: Array>>; name?: string; group?: string; description?: string; params?: TParams; query?: TQuery; body?: BodyValidation; /** Whether the request body is required. Defaults to true when `body` is set. */ bodyRequired?: boolean; res?: TResponse; };