ETDL — Event Tree Definition Language for VS Code

Reliability modeling for event-driven microservices, right in your editor. This extension brings syntax highlighting, live validation, and IEC 62502 / IEC 61025 event tree visualization for the Event Tree Definition Language (.etdl).
ETDL is a declarative, design-time DSL that models causal sequences as event trees (IEC 62502:2010) and failure probability as fault trees (IEC 61025:2006), resolved against AsyncAPI 3.0 contracts — and compiles to code.
Features
🎨 Syntax highlighting
A TextMate grammar overlays the YAML structure with ETDL-specific scopes:
- Node types (
barrier, operation, consequence)
- Fault tree gates (
AND, OR, NOT, XOR, VOTING)
- Branch outcomes (
SUCCESS, FAILURE)
- ECEL condition expressions
- JSON Pointer references (
orders_api#/components/messages/OrderPlaced)
- Retry/backoff policies, probabilities, failure rates
✅ Live validation
The embedded ETDL compiler (Rust → WASM, no CLI needed) validates your document on open, edit, and save:
- Syntax errors — malformed YAML, missing required sections
- Semantic errors — invalid probabilities, barrier branch sums ≠ 1.0, ECEL type errors (V-204), fault tree gate arity, unresolved references
- Warnings — non-fatal suspicious patterns
Diagnostics appear in the Problems panel with squiggly underlines. Errors are prefixed with their diagnostic code (E-103, V-204, W-402, …).
📊 Event tree visualization
Render your event trees and fault trees as an interactive diagram:
- Barriers as decision diamonds with branch probabilities and ECEL conditions
- Operations as rectangles with retry policy, timeout, and failure probability source
- Consequences as terminal shapes
- Fault trees with top event, gates (AND/OR/NOT/XOR/VOTING), and basic-event probabilities
- Zoom in/out, refresh, color-coded by node type
The panel updates live as you edit.
Usage
- Open any
.etdl file — highlighting activates automatically.
- Validate on demand with Command Palette → "ETDL: Validate Document".
- Visualize with Command Palette → "ETDL: Visualize Event Tree" or the diagram button in the editor title bar.
AsyncAPI imports
The validator resolves asyncapi_imports (JSON Pointer references into AsyncAPI 3.0 YAML/JSON files). Files referenced by your document are read from your workspace automatically.
Configuration
| Setting |
Default |
Description |
etdl.validation.enable |
true |
Enable live validation |
etdl.validation.debounce |
500 |
Debounce delay (ms) before revalidating after edits |
etdl.visualization.renderer |
raaml |
Diagram renderer (raaml or mermaid) |
etdl.visualization.layoutDirection |
auto |
Diagram layout (auto, LR, TB) |
etdl.visualization.colorScheme |
current |
Color scheme (current, theme, raaml) |
IntelliSense
The extension wires the compiler's WASM semantic endpoints into native VS Code
providers:
- Go to definition — jump from a
next/onFailure/rootCause reference to
its node.
- Find references — all references to a node/gate/event.
- Hover — semantic details at the cursor.
- Outline — event trees, fault trees, nodes, gates, basic events.
- Completion — ETDL keywords and values.
- Format — canonical document formatting.
- Diagnostics — errors/warnings navigate to the exact source location (span
positions from the compiler).
Example
etdl: "1.0.0"
info:
title: "Order Fulfillment"
version: "2.0.0"
domain: "FulfillmentContext"
eventTrees:
OrderFulfillment:
initiatingEvent:
id: OrderPlacedTrigger
message: "orders_api#/components/messages/OrderPlaced"
next: InventoryCheckBarrier
nodes:
InventoryCheckBarrier:
type: barrier
branches:
- outcome: SUCCESS
condition: "message.payload.items[*].qty > 0"
probability: 0.95
next: ProcessPaymentOperation
- outcome: FAILURE
condition: "default"
probability: 0.05
next: OutOfStockConsequence
faultTrees:
PaymentGatewayFailure:
topEvent:
id: PaymentCaptureFailed
rootCause: GatewayUnavailableOrRejected
gates:
GatewayUnavailableOrRejected:
type: OR
inputs: [GatewayUnreachable, ChargeRejected]
basicEvents:
GatewayUnreachable:
probability: 0.008
ChargeRejected:
failureRate: 0.00021
missionTime: 24
Development
The extension bundles etdl-wasm (the ETDL validator compiled to WebAssembly) in pkg/. The pkg/ files are committed, so a fresh checkout works out of the box. To rebuild them from source:
# 1. Rebuild the WASM validation engine
# (clones the ETDL compiler repo, builds etdl-wasm, copies bindings into ./pkg)
bash scripts/build-wasm.sh
# 2. Compile TypeScript
npm install
npm run compile
# 3. Run unit tests (no GUI required)
npm run test:unit
# 4. Package a .vsix
npm run package
Requirements for step 1: Rust with the wasm32-unknown-unknown target and wasm-bindgen-cli (see scripts/build-wasm.sh).
License
Apache 2.0 — see LICENSE.
Links