createArgumentsSchema<const TParameters>
Builds the input schema of a method contract: a schema over the method’s ARGUMENT LIST, one type guard per parameter. An argument that fails its guard is reported with its index as the issue path, and an argument list longer than the parameter list is refused. A missing argument reaches its guard as undefined, so an optional parameter’s guard accepts undefined (see optionalGuard).
Import:
import { createArgumentsSchema } from '@mnaoumov/typescript-lib/api-contract';Signature:
function createArgumentsSchema(parameters: ArgumentTypeGuards<TParameters>, options: CreateArgumentsSchemaOptions | undefined): StandardSchemaV1<unknown, MutableTuple<TParameters>>Parameters:
| Parameter | Type | Description |
|---|---|---|
parameters |
ArgumentTypeGuards<TParameters> | One guard per parameter, in order. |
options |
CreateArgumentsSchemaOptions | undefined | The options for the schema. |
Returns: StandardSchemaV1<unknown, MutableTuple<TParameters>> — The schema.
Links to this page: