function validatedStateKey
Since 0.2.0
validatedStateKey(target: ValidationTarget): string

Builds the ctx.state key under which the validated value for a target is stored — the cross-package wire format between the writer (validation-plugin's middleware) and any reader (e.g. decorator-plugin's parameter resolvers). Both sides import this helper so the key can never drift between the package that writes it and the one that reads it back.

Examples

Example 1

ctx.state.set(validatedStateKey('body'), parsedValue);
const validated = ctx.state.get(validatedStateKey('body'));

Parameters

The request part the value was validated from

Return Type

string

The state key — `validation-plugin:validated-${target}`

Usage

import { validatedStateKey } from "common/src/index.ts";