Skip to content

ActionInputSchemaResolver

Derives a JSON Schema for one action+method’s request parameters from whatever validators that action declares, so a single declaration can drive HTTP validation, an MCP tool’s inputSchema and an OpenAPI operation’s parameters/requestBody.

Both “validator file” conventions feed the same ValidatorSchemaMapper: the {module}/Validate/{action}.xml file convention (CompiledValidatorRegistry uses the same path) is tried first, and failing that the action’s fluent register{Method}Validators()/registerValidators() hook (the convention every documented example uses — see ValidatorBuilder) is registered against a throwaway ValidationManager and read back. That throwaway manager is never executed, so no request-validation side effect (exports, incidents) occurs.

Returns null — callers fall back to a permissive schema, or to describing nothing — when neither source yields anything describable. Never throws: a schema-derivation failure must not break tool discovery or doc generation.

final class ActionInputSchemaResolver

Since1.2.5
SourceValidator/Compiler/JsonSchema/ActionInputSchemaResolver.php

public function __construct(?ValidatorSchemaMapper $mapper = null): mixed

ParameterTypeDescription
$mapper?ValidatorSchemaMapper

Returns mixed

MethodDescription
[`resolve(Controller $controller, string $module, string $action, string $methodToken): array<string, mixed>null`](#resolve)
[`resolveForAction(Controller $controller, Action $action, string $module, string $actionName, string $methodToken): array<string, mixed>null`](#resolveforaction)

public function resolve(Controller $controller, string $module, string $action, string $methodToken): array<string, mixed>|null

Resolve for a module/action pair, instantiating the action the same way Controller::createActionInstance() does for a real request.

read/write/update/remove/… (see HttpMethodMapper).

ParameterTypeDescription
$controllerController
$modulestring
$actionstring
$methodTokenstringread/write/update/remove/… (see HttpMethodMapper).

Returns array``<``string``, ``mixed``>``|``null

public function resolveForAction(Controller $controller, Action $action, string $module, string $actionName, string $methodToken): array<string, mixed>|null

Resolve for an action instance the caller already has.

The instance is initialized and its validator hook called, so pass a freshly created one (registering the same validators twice would duplicate them).

ParameterTypeDescription
$controllerController
$actionAction
$modulestring
$actionNamestring
$methodTokenstring

Returns array``<``string``, ``mixed``>``|``null