ObjectStackObjectStack

Action Params

Action Params protocol schemas

The action DISPATCH contract: what the platform validates on the way in, and what it hands the handler on the way out.

Two halves, one surface. Inbound — action-param VALUE validation (ADR-0104 D2), below. Outbound — the runtime context an action body / handler receives: ActionSessionSchema (the ctx.session contract, #5697), ActionEngineFacade, ActionHandlerContext and ActionHandler.

Inbound — action-param VALUE validation (ADR-0104 D2)

An action's declared params[] is a complete value contract — type, required, multiple, options, reference — but before this it only informed the client dialog: the server passed reqBody.params straight to the handler, unvalidated (http-dispatcher.ts). This module is the pure contract that lets the REST and MCP dispatch paths enforce that declaration BEFORE the handler runs, reusing the D1 field value-shape contract (valueSchemaFor).

Purity: schema derivation only (Prime Directive #2). Field-backed params are resolved to their effective value-shape inputs by the CALLER (the runtime, which holds the object metadata registry); this module validates the already resolved descriptors.

Source: packages/spec/src/ui/action-params.zod.ts

TypeScript Usage

import { ActionSessionSchema } from '@objectstack/spec/ui';
import type { ActionSession } from '@objectstack/spec/ui';

// Validate data
const result = ActionSessionSchema.parse(data);

ActionSession

Action-body ctx.session — the caller identity an action body reads (runtime shape, never authored)

Properties

PropertyTypeRequiredDescription
userIdstringoptionalInvoking user id (absent when the call carries no user)
organizationIdstringoptionalActive organization id (blessed developer-facing name; absent when the call is org-less)
positionsstring[]optionalPosition names held by the caller (ADR-0090 D3 vocabulary; the value of ExecutionContext.positions, whose schema comment reads "Formerly roles") — the CANONICAL spelling at this boundary and the key an action body should read. Within the #5613 deprecation window buildActionSession() emits the same array under both this key and the deprecated roles, so migrating is a change of key and nothing else; roles is then removed on the v11 session-alias removal path (#3280 deprecate → #3290 remove: one window, then gone). Never gate PRIVILEGE on this array — ask the security service, which evaluates capability grants, placements and the derived posture (ADR-0095), never a position-name string comparison.
rolesstring[]optionalDEPRECATED alias of positions — the same caller position names under the one spelling ADR-0090 D3 forbids (the value is ExecutionContext.positions, "Formerly roles"). Read positions instead: within the #5613 deprecation window buildActionSession() emits both keys with identical values, so migrating is a change of key and nothing else. The migration prescription and its acceptance criteria are the ADR-0087 semantic migration action-session-roles-to-positions; removal follows the v11 session-alias removal path (#3280 deprecated → #3290 removed). Never gate PRIVILEGE on this array — ask the security service, which evaluates capability grants, placements and the derived posture (ADR-0095), never a role-name string comparison.

On this page