@burgan-tech/vnext-schema
v0.0.62
Published
JSON Schema definitions for vNext vNext Workflow components validation
Readme
@burgan-tech/vnext-schema
JSON Schema definitions for vNext Workflow components validation.
Overview
This package provides comprehensive JSON Schema definitions used by the vNext ecosystem to validate workflows and components developed with the vNext Workflow product. These schemas ensure consistency and validity of workflow definitions, tasks, views, functions, and other components within the vNext platform.
Included Schemas
- Core Schema: Base schema definition for all vNext components
- Workflow Definition: Schema for workflow component definitions (
sys-flows) - Task Definition: Schema for task component definitions (
sys-tasks) - View Definition: Schema for view component definitions (
sys-views) - Function Definition: Schema for function component definitions (
sys-functions) - Extension Definition: Schema for extension component definitions (
sys-extensions) - Schema Definition: Meta-schema for schema definitions (
sys-schemas) - Mapping Definition: Schema for mapping component definitions (
sys-mappings) - Agent Definition: Schema for AI agent component definitions (
sys-agents, experimental) - Core Header: Schema for runtime HTTP headers and metadata (
sys-schemas)
Supported Task Types
task-definition.schema.json validates 24 task types, selected through the attributes.type discriminator. Each type has its own attributes.config shape:
| type | Task | Purpose |
|--------|------|---------|
| 1 | Dapr HTTP Endpoint | Call an external HTTP endpoint through Dapr |
| 2 | Dapr Binding | Invoke a Dapr output binding |
| 3 | Dapr Service | Service-to-service invocation via Dapr |
| 4 | Dapr PubSub | Publish a message to a Dapr pub/sub topic |
| 5 | Human Task | Wait for a human decision |
| 6 | HTTP Task | Direct HTTP call |
| 7 | Script Task | Execute a C# script (.csx) |
| 8 | Condition Task | Evaluate a condition |
| 9 | Timer Task | Delay / scheduled continuation |
| 10 | Notification Task | Send a notification |
| 11 | Start Flow Task | Start another workflow instance |
| 12 | Trigger Transition Task | Trigger a transition on an instance |
| 13 | Get Instance Data Task | Read instance data |
| 14 | SubProcess Task | Run a sub-process |
| 15 | Get Instances Task | Query workflow instances |
| 16 | SOAP Task | Call a SOAP service |
| 17 | State Store Task | Read/write a Dapr state store |
| 18 | Cache Aside Task | Cache-aside read-through |
| 19 | Get Instance Task | Read a single instance |
| 20 | Dapr Conversation Task | Dapr conversation (LLM) call |
| 21 | FanOut Task | Run an inner task once per collection item, in parallel, and join the results |
| 22 | External HTTP Task | Same configuration contract as type 6, executed directly by the Orchestrator process instead of being routed through the Execution service |
| 23 | Python Task | Call a named handler in the domain's own Python runtime container |
| 24 | MCP Task | Call one operation of a remote MCP server over streamable HTTP (experimental) |
External HTTP Task (type: "22")
Type 22 shares the type-6 HTTP configuration surface unchanged (url, method, headers, body,
contentType, rawBody, timeoutSeconds, validateSsl, acceptedStatusCodes) — in the runtime
ExternalHttpTask derives from HttpTask, so mapping scripts (task as HttpTask) work for both.
Only the transport differs: the call runs in-process in the Orchestrator, so no Dapr sidecar,
circuit breaker or remote-invocation timeout participates — the task's own timeoutSeconds
(default 30) is the only bound. In this schema both types validate against the same if/then
branch; adding an HTTP config field means adding it once, for both.
Python Task (type: "23")
Calls a handler registered in the domain's Python runtime image (built FROM
ghcr.io/burgan-tech/vnext/python-runtime, enabled per domain with pythonRuntime.enabled in the
Helm chart). The Orchestrator calls it directly over Dapr service invocation; the code and its
packages live in the image, so the task carries only a handler name:
{
"type": "23",
"config": {
"handler": "risk_score",
"input": { "income": 85000 },
"timeoutSeconds": 20
}
}handler is required (^[A-Za-z_][A-Za-z0-9_.-]{0,127}$), input is any JSON value and may be
replaced by the task's input mapping (SetInput), timeoutSeconds is 1–50 (default 30). The config
is closed: the earlier inline-script shape (script, executionMode) is rejected. Runtime contract
and handler authoring: docs/runtime/python-task.md in the vnext repository.
MCP Task (type: "24")
Calls one operation of a remote MCP (Model Context Protocol) server over streamable HTTP, in-process
on the Orchestrator. Used standalone and as the binding of an agent's kind: 3 tool. Experimental.
{
"type": "24",
"config": {
"transport": "http",
"endpoint": "https://crm-mcp.internal/mcp",
"auth": { "header": "Authorization", "scheme": "Bearer", "secretRef": "vault/workflow-secret/CRM_MCP_TOKEN" },
"headers": { "X-Tenant": { "secretRef": "CRM_TENANT" } },
"operation": "callTool",
"tool": "search_customer",
"arguments": { "q": "x" },
"timeoutSeconds": 20
}
}endpoint is required (absolute http(s)); operation is one of callTool (default), listTools,
readResource (needs uri), listResources, getPrompt (needs prompt), listPrompts;
timeoutSeconds is 1–120 (default 20). Credentials are never authored inline: auth needs a
secretRef and every headers value is a { "secretRef": "…" } object — a plain-text header value is
rejected. The endpoint host allow-list (Mcp:AllowedHosts) is checked by the runtime, not here.
FanOut Task (type: "21")
The FanOut task executes a referenced inner task once per item of a runtime-resolved collection, in parallel, then joins the per-item outcomes into a single output.
{
"type": "21",
"config": {
"mode": "inline", // only 'inline' is accepted in this phase
"itemsPath": "$.documents.online", // dot-path into instance data (or use the mapping's ItemSelector)
"itemAlias": "document", // readability label for logs/traces only
"task": { // required: the inner task run per item
"key": "upload-document",
"domain": "core",
"flow": "sys-tasks",
"version": "1.0.0"
},
"execution": {
"maxDegreeOfParallelism": 4, // default 4
"itemTimeoutSeconds": 30, // must be <= batchTimeoutSeconds
"batchTimeoutSeconds": 120
},
"join": {
"policy": "allSettled", // all | allSettled | quorum | firstSuccess
"resultKey": "fanOutResults" // instance data key for item results + '{resultKey}Summary'
},
"errorBoundary": { // applied per ITEM, same rule shape as state/transition boundaries
"onError": [
{ "action": 1, "errorCodes": ["FanOut:ItemTimeout"], "retryPolicy": { "initialDelay": "PT2S" } }
]
}
}
}Authoring notes:
- Only
config.taskis required; every other member has a runtime default. join.minSuccessis required whenjoin.policyisquorum.- Exactly one item source must be configured — either
config.itemsPathor the task mapping'sItemSelector, never both and never neither. This rule is enforced by the runtime, not by the schema. execution.itemTimeoutSecondsmust be less than or equal toexecution.batchTimeoutSeconds(also runtime-enforced).- A FanOut task cannot reference another FanOut task as its inner task.
join.orderedis accepted for forward compatibility; ininlinemode item results are always ordered by item index.
AI Agent State and sys-agents (experimental)
A workflow state of stateType: 6 (AiAgent) runs a sys-agents component on entry and lets it pick one
of the state's automatic transitions. The state must carry an agent block (no other state type may);
its sub type is 0 or 5 and it cannot run a subFlow.
{
"key": "classifying", "stateType": 6, "subType": 5,
"agent": {
"agent": { "key": "triage-agent", "domain": "core", "flow": "sys-agents", "version": "1.0.0" },
"prompt": { "template": "<message>{{ data.message }}</message>",
"messages": [ { "role": "user", "content": "Example: my card is lost" } ],
"context": { "customer": "data.customer" } },
"output": { "path": "$.triage" },
"decision": { "mode": "model", "fallback": "classify-failed" }
},
"transitions": [ { "key": "is-question", "target": "drafting", "triggerType": 1, "description": "The customer asks." } ]
}agent,prompt(atemplate, or a C#location+code),output.path($.…) anddecision.fallbackare required.decision.mode:model(default) |rules|script(needsdecision.mapping).mode:single(default) |sequential|concurrent|handoff. A team mode needs at least one participant inagents[](namematching^[a-zA-Z0-9_-]{1,64}$,agent,description);singleallows none.- Every transition shape accepts an optional
description: the "when" text the agent sees for a candidate. - Candidate counts, reserved exits being rule-less automatic transitions and
hintskeys are checked by the runtime at publish, not here.
agent-definition.schema.json validates the sys-agents component. provider (a profile name, never an
endpoint or key), instructions, output.schema (type: object) and policy are required. tools[] entries
are kind 1 (task: binding.task), 2 (script: binding.code as ScriptCode) or 3 (MCP: binding.task
pointing at a type-24 task, a non-empty binding.allow, an optional prefix). Kinds 1 and 2 need name
(matching ^[a-zA-Z0-9_-]{1,64}$), description and object parameters, and may set requiresApproval.
memory (mode, storage, compaction: trim | summarize, …), model and audit are optional.
Tool-name uniqueness and the environment ceilings are runtime checks.
Field Exposure Vocabulary (view-vocab.json)
Master-schema properties can declare how their value leaves the runtime. The runtime evaluates them in a
fixed order: x-roles → x-masking → x-encryption. A property hidden by x-roles is pruned and
never reaches the later keywords.
| Keyword | Shape | Runtime |
|---|---|---|
| x-roles | array of roleGrant ({ role, grant: allow \| deny }) | hides the field from callers the grants refuse |
| x-masking | { operator: mask \| replace, params?, roles? } | masks the visible value; roles is an allow-only exemption list (an allow match sees the raw value) |
| x-encryption | { source?: runtime, type: none \| hash \| encrypt, params?, roles?, purpose?, redactInLogs?, retentionDays? } | source: runtime (the default when absent) — at rest. hash: applied when the data is written — the stored and served value is HASHED:SHA256:<hex> (HMAC under a salt the runtime generates per instance); irreversible, so no roles and no pattern/format/minLength/maxLength/enum/const. encrypt: AES-256-GCM token ENCRYPTED:AES256:i1:… in the stored instance data (key generated per instance), decrypted for the engine; on the data function an allow-listed caller reads the plaintext, everyone else the token; only instance data is encrypted. roles is an allow-only exemption list; the metadata fields are not enforced. transport/persisted were removed (never enforced) — use encrypt |
| x-encryption | { source: client, key, algorithm: HPKE-P256-SHA256-AES128GCM \| RSA-OAEP-256, into?, encoding?, nonce?, envelope?, purpose? } | source: client — in transit, client → backend: the client seals the value to the recipient's public key before sending; only the service holding the private key opens it. The runtime accepts it on any schema, the master included, and does nothing with it (no at-rest encryption, no read mask, no filter refusal). The at-rest members are not accepted. Replaces the former x-encrypt |
| x-storage | { binding } | file offload: the property's file bytes are kept in the named Dapr binding component instead of the instance data; binding is required and non-empty, no other fields |
Rules the runtime enforces at publish time for x-masking and x-encryption.type: "hash" (the vocabulary
expresses the shape; the runtime adds the context): type: "string" properties reachable through nested
properties (any schema component type; they take effect on the schema a workflow references as its data schema), not together with x-filterOperators, x-sortable or x-indexed, one transform per field
(x-masking next to an active x-encryption is rejected), and for hash a salt configured on the host.
"tckn": {
"type": "string",
"x-encryption": {
"type": "hash",
"params": { "algorithm": "sha256" },
"purpose": "PII-Identification",
"redactInLogs": true,
"retentionDays": 2555
}
}"password": {
"type": "string",
"format": "password",
"x-encryption": {
"source": "client",
"key": "urn:client:context:read:device:memory:device.hpke.publicKey",
"algorithm": "HPKE-P256-SHA256-AES128GCM",
"into": "passwordEnc",
"envelope": "publicKey"
}
}"iban": {
"type": "string",
"x-masking": {
"operator": "mask",
"params": { "keepFirst": 2, "keepLast": 4, "maskingChar": "*" },
"roles": [ { "role": "morph-idm.auditor", "grant": "allow" } ]
}
}"accountNumber": {
"type": "string",
"x-encryption": {
"type": "encrypt",
"roles": [ { "role": "morph-idm.auditor", "grant": "allow" } ]
}
}The exemption lists of x-masking and x-encryption take plain { "role", "grant": "allow" } entries only —
no deny and no allOf / anyOf. A caller matching an allow entry sees the raw value (the plaintext, for
encrypt); every other caller — including one whose role is misspelled or missing — sees it masked (the
token, for encrypt). hash takes no roles: the digest is irreversible.
Query and Form Keywords (view-vocab.json)
| Keyword | Shape | Notes |
|---|---|---|
| x-filterOperators | array of eq, neq, gt, gte, lt, lte, between, contains, startsWith, endsWith, in, nin, isNull, includes | the names the runtime matches a declaration against: a list query's token is mapped first (ne→neq, ge→gte, le→lte, like/match→contains), so declaring the query token (ge) makes every such filter fail |
| x-lov | { source \| items, valueField, displayField, imageField?, filter? } | exactly one of source (a URN, fetched; may interpolate {{$form.x}}) and items (an expression naming an array already in scope, no request); a filter param may carry an operator (status:in) and a literal value may be an array |
| x-conditional | { showIf?, hideIf?, enableIf?, disableIf? } of condition | operators also include greaterThanOrEquals, lessThanOrEquals, startsWith, endsWith |
| x-errorMessages | localized text per validation keyword | also minItems / maxItems |
| x-order | number | a generated form's field order, lower first; a stored schema does not keep property order (jsonb) |
| x-computed | { evaluatedBy: runtime \| client, cases?, fallback?, whenAbsent? } | a derived, never-stored field (master only). runtime: the runtime computes it on every read surface from the caller's already-shaped view (after x-roles / x-masking / x-encryption); client: a client evaluates it. Each case / the fallback is a join (fields, separator) or an arithmetic (op, fields) over sibling properties; the first case whose when matches wins |
Role Vocabularies (#153)
A schema plays one ROLE, and what an x-* keyword means depends on it. The schema component's
attributes.type names the role and selects the vocabulary schema-definition.schema.json validates
attributes.schema against:
| attributes.type | Role vocabulary | x-indexed |
|---|---|---|
| master | record-vocab.json | allowed |
| transition | input-vocab.json | refused |
| function | input-vocab.json | refused |
| component | component-vocab.json | refused |
| absent / "" | none (no role gate) | refused |
These files compose the existing definitions by role (no definition is duplicated — each $refs
view-vocab.json / data-vocab.json):
| File | Role | Adds |
|---|---|---|
| data-base-vocab.json | shared by both | x-labels, x-enum, x-order, x-displayFormat, x-lov, x-lookup, x-errorMessages, x-validation, x-conditional |
| record-vocab.json | a flow's master schema | x-roles, x-masking, x-encryption, x-storage, x-indexed, x-filterOperators, x-sortable, x-computed, x-context-target — x-encryption with either source (runtime applied at rest, client accepted and not handled by the runtime) |
| input-vocab.json | a transition schema / function inputSchema / the dataSchema of a view that submits a move of its own | x-context-source, x-encryption with source: client only (in transit, client → backend) |
| component-vocab.json | the dataSchema of an embedded view (Component ref) that sends nothing of its own | x-binding (the component's input contract) |
| view-hints-vocab.json | mixin, every role | x-helpText, x-placeholder, x-uiHint, x-uiNote, x-group |
A component does not inherit the role of the view that embeds it: the host BINDS its data into the component, and
keeps every role-specific behaviour on its own schema (what is sent and how — x-context-source, x-encryption with source: client; what the
record exposes and copies out — x-roles, x-masking, x-context-target). A component that submits uses a command
the host passes in ($param.submitCommand), so the move and its body are still the host's.
<role>-vocab.json#/definitions/schema validates a whole schema in
that role, recursively (properties, items, combinators, definitions): any x-* keyword outside the role's
list is refused. #/definitions/allowedKeywords carries the same list as data, for a tool that wants to
report rather than refuse.
The schemas $ref the vocabularies by $id, so a validator must register them before compiling:
const Ajv = require('ajv');
const { addVocabularies, schemaDefinition } = require('@burgan-tech/vnext-schema');
const validate = addVocabularies(new Ajv({ strict: false })).compile(schemaDefinition);Installation
npm install @burgan-tech/vnext-schemaUsage
This package is primarily designed to be used with the @vnext/cli tool for workflow development and validation.
Using with @burgan-tech/vnext-cli
The recommended way to use these schemas is through the official vNext CLI:
npm install -g @burgan-tech/vnext-cliThe CLI automatically uses these schema definitions for:
- Validating workflow definitions
- Checking component structure
- Ensuring compliance with vNext standards
- Development-time validation
For detailed CLI usage and workflow development guide, please refer to the @vnext/cli documentation.
Programmatic Usage
If you need to access the schemas programmatically:
const schemas = require('@burgan-tech/vnext-schema');
// Get specific schema
const workflowSchema = schemas.workflowDefinition;
const taskSchema = schemas.taskDefinition;
const headerSchema = schemas.coreHeader;
// Get schema by type
const coreSchema = schemas.getSchema('core');
const headerSchemaByType = schemas.getSchema('header');
// Get all available schema types
const availableTypes = schemas.getAvailableTypes();
// Returns: ['core', 'workflow', 'task', 'view', 'function', 'extension', 'schema', 'mapping', 'agent', 'header']Schema Structure
All schemas follow the vNext component structure with required fields:
key: Component identifierversion: Semantic version (Major.Minor.Patch)domain: Domain identifierflow: Flow identifierflowVersion: Flow versiontags: Component tagsattributes: Component-specific attributes
Contributing
This package is maintained by the vNext Team. For issues, feature requests, or contributions, please visit the GitHub repository.
License
MIT
Support
For support and questions:
- GitHub Issues: https://github.com/burgan-tech/vnext-schema/issues
Note: This package is part of the vNext ecosystem and is primarily intended for use with the official vNext CLI tools and vNext Workflow platform.
Schema component purpose
Schema component documents (sys-schemas) state their role in the optional attributes.type:
master, transition, component or function (see Role Vocabularies).
It may be omitted or "" (no role). Any other value — including the legacy workflow, schema,
view, headers — is refused; migrate a flow's master to master, a transition / function input
to transition / function, an embedded view's dataSchema to component, and a schema that
serves more than one role to no type. Only master allows x-indexed metadata (including false).
There is no component root type field, and nested JSON Schema type keywords retain their meaning.
For an explicit master schema, x-indexed must be boolean. true requires an explicit scalar
type of string, number, integer, or boolean beneath fixed object properties; date fields
remain strings with format: "date-time". Nested objects may omit their object type. The first path
segment must match [a-zA-Z][a-zA-Z0-9_]*; subsequent segments allow [a-zA-Z0-9_]+.
Arrays, object-valued indexed fields, ambiguous types, references, and conditional/composed indexed
nodes or ancestors are rejected. Index requests in definitions, pattern properties, and other dynamic
schema locations are also rejected. Unrelated conditional siblings and literal examples, default,
const, or enum data are unaffected. false disables indexing and does not require a scalar type;
it is still invalid outside an explicit master schema. Omitting x-indexed requests no index and
validation does not insert a default value.
For example, inside a component with attributes.type: "master":
{
"type": "object",
"properties": {
"amount": { "type": "number", "x-indexed": true },
"customer": {
"type": "object",
"properties": {
"name": { "type": "string", "x-indexed": true }
}
}
}
}This validates index eligibility only. The CLI generates SQL and the DBA schedules execution; validation does not create indexes or change filter/sort permissions.
