On this page

Operations

Meaning

An Operation is a named executable semantic capability of the authored software.

Operation identity exists independently of transport. HTTP, schedules, WebSocket reachability, and future callable transports are owned mappings around the Operation rather than root declarations.

Canonical shape

An Operation may define:

  • optional group;
  • optional semantic role;
  • one input: named fields, or one schema;
  • one output;
  • declared failures;
  • emitted Events;
  • access/policy requirements;
  • execution semantics;
  • Operation-owned facets (http, websocket, schedule), one per kind;
  • universal semantic metadata.

Roles

The canonical optional role vocabulary is:

text
create
update
delete
detail
list
search
validate
transform
action

A role describes semantic intent. It does not select a framework controller, ORM operation, route, transport, or implementation strategy.

When an operation directly references a projected Schema, Runtime validation checks that the projection purpose matches the role and direction:

Operation roleInput projection purposeOutput projection purpose
createcreateread
updateeditread
deletequeryread
detailqueryread
listqueryread
searchqueryread

custom is compatible in either direction as an explicit exception. validate, transform and action impose no projection-purpose constraint. Ordinary non-projected Schemas remain valid for every role; roles do not cause hidden projection derivation. Validation applies to a whole-schema input, each named schema-valued input field and a schema-valued output. Nested Schemas inside a wrapper are validated through their own declarations rather than recursively assigned an Operation role.

An incompatible direct reference produces ir.operation.projection_purpose_incompatible at the input or output reference. Authors and compilers preserve the explicit role and projection purpose; the Engine owns this compatibility decision.

Input and output

An Operation takes one input and returns one output, like a component that takes one props object. Every value it receives has a name, so bindings and generated code use names, never positions.

The input is either named fields, in declaration order:

yaml
input:
  fields:
    - name: userId
      value:
        $ref: "#/properties/primitives/shared.Id"
    - name: body
      value:
        $ref: "#/schemas/users.UpdateUserBody"
output:
  value:
    $ref: "#/schemas/users.User"

or one schema, whose fields are the input fields:

yaml
input:
  schema:
    $ref: "#/schemas/users.UserListQuery"

Both are optional. Field names are unique, and values are ValueRefs (PropertyRef | SchemaRef). Operations don't own anonymous type expressions: richer meaning is modelled as Properties or Schemas first.

Templates always see named fields: for a schema input, operation.input.fields lists the schema's effective fields (ordered by name), and operation.input.value is the schema itself.

Port references

A reference to an Operation's output, or to one of its input fields:

yaml
$ref: "#/operations/users.UpdateUser"
direction: input
field: userId

field names an input field. It is omitted for the output, and for the whole input when the input is one schema (for example, a list endpoint binding its query schema as a query object). Validation rejects unknown fields, whole-input references to an inline-fields input, and duplicate bindings. Required fields must all be bound; optional schema fields may be left out.

Do not use physical pointers such as #/operations/users.CreateUser/input/fields/user.

Workflows still bind by position. An operation step sees a schema input as position 0 and named fields in declaration order; the output is position 0.

Failures and Events

Operations may declare reusable Failure references and emitted Event references:

yaml
failures:
  - $ref: "#/failures/users.EmailTaken"
emits:
  - $ref: "#/events/users.UserCreated"

The Failure/Event definitions remain owned by their canonical registries.

An Operation emitting an Event and an Event declaring listeners are separate relationships:

text
Operation -> emits -> Event
Event -> listeners -> Operation / Workflow

Access and execution

Operation-owned semantic execution facets currently include:

  • sync/async mode;
  • timeout;
  • rate limiting;
  • cache TTL;
  • transaction requirement;
  • retry/backoff;
  • idempotency;
  • audit requirement;
  • invalidation relationships.

Idempotency references an input port of the same Operation through OperationPortRef.

Framework middleware, guards, queue products, transaction libraries, cache providers, controller classes, decorators, and similar implementation details remain pack concerns.

Trusted record scope

An Operation may declare trusted constraints for selecting persisted records. Each binding names a persisted field directly and a value provided by a Policy attached to that Operation:

yaml
scope:
  bindings:
    - target:
        $ref: "#/schemas/orders.Order"
        field: tenantId
      source:
        policy:
          $ref: "#/policies/orders.CurrentTenant"
        name: tenantId

The target Schema must have persistent storage, and the target must resolve to a scalar property with a statically known type. The named Policy must appear in access.policies, declare the named value under context.provides, and provide a value of the same type. A field may be bound only once per Operation.

Scope is valid for detail, list, search, update, and delete, which select existing records. A detail/update/delete Operation can use a path ID and body without a query projection; the binding still targets the persisted Schema field directly. When an Operation has query or read projections, clients and packs use their field mappings to identify aliases that expose the scoped field and reject those aliases during request validation. A scoped field is not a caller-controlled filter.

The Policy evaluator supplies the trusted value in operation context. Every declared predicate is combined with ordinary client filters using conjunction. Missing trusted values fail closed. Scope is never inferred from names, roles, Groups, relations, path values, or transport configuration. The Engine validates declarations but does not evaluate Policies or execute database queries; those remain application and pack responsibilities. Operations without scope retain their existing meaning.

Operation-owned facets

There is no root transport registry. Transport reachability belongs to the owning Operation as facets, with at most one facet per kind (decision 0012).

An operation with an http facet must belong to a feature (feature set). A group-owned operation serves other purposes, such as workflows and events, and is never an HTTP endpoint. Validation fails with ir.http.feature_required otherwise.

For example:

yaml
operations:
  users.CreateUser:
    input:
      schema:
        $ref: "#/schemas/users.CreateUser"
    output:
      value:
        $ref: "#/schemas/users.User"
    facets:
      http:
        method: POST
        path: /users

The facet key is its kind, so facets carry no kind field. Pack facet: http|websocket|schedule filters match these keys.

HTTP

HTTP bindings explicitly connect transport sources and responses to named input fields, the whole schema input, or the output.

Example:

yaml
facets:
  http:
    method: POST
    path: /users
    inputs:
      - port:
          $ref: "#/operations/users.CreateUser"
          direction: input
        source:
          kind: body
    outputs:
      - port:
          $ref: "#/operations/users.CreateUser"
          direction: output
        response:
          status: 201

HTTP path/query/header/cookie/body/form/multipart semantics are transport mappings. They do not redefine Operation input meaning.

Schedule

A schedule that invokes a semantic capability is Operation-owned:

yaml
facets:
  schedule:
    schedule:
      kind: daily
      hour: 2
      minute: 30
      time_zone: Africa/Nairobi

WebSocket

WebSocket reachability is Operation-owned. Event emission/listening remains represented through Operation emits and Event listeners, not duplicated inside WebSocket transport configuration.

Boundaries

Operations reference Properties/Schemas for value meaning, Policies for reusable rules, Failures for declared failure meaning, and Events for occurrences emitted during execution.

Operations do not own those definitions.

Transport is subordinate to Operation meaning. Packs decide how canonical Operations become controllers, RPC procedures, workers, handlers, queues, framework decorators, SDK methods, or other generated implementation artifacts.

Search in