Skip to content
Data & Databases

Contract Node Table Integrity Validator Before Restore

8 nodes 10 1 Manual trigger
Download

Loading workflow…

Workflow Description

A self-contained workflow that inspects existing root+nodes reference tables without building them or restoring any graph. Per table it indexes ids and flags duplicates, validates the declared schema, records every dangling ref with source id, field path and missing target, computes unreachable nodes from the root via BFS, and detects self and multi-node cycles with an iterative Tarjan SCC while separating shared references. An If node routes on valid, two Set nodes render summaries, and a final Code node orders the merged reports.

How it works

  1. 1.Manual Trigger, then a Code node emits two fictional tables: a healthy one with an allowed cycle and a broken one with a dangling ref, duplicate id, unreachable nodes and a self cycle
  2. 2.Build the id index, exclude duplicate occurrences and list them in duplicateIds
  3. 3.Validate node type object/array and that fields is an object, collecting schema errors
  4. 4.Collect edges from {$ref:id} and record each dangling ref with source node id, field path and missing target id
  5. 5.Run BFS from the root to compute unreachableNodeIds without deleting any node
  6. 6.Detect cycles with an iterative Tarjan SCC, distinguishing self from multi-node cycles, and record sharedRefs
  7. 7.Route on valid with If, emit status and summary with two Set nodes, append with Merge, then order reports in a final Code node

Use cases

  • Validate a reference table before handing it to an object-graph restore algorithm
  • Audit tables produced by an earlier encoding stage before restore
  • Screen large node tables for duplicate ids, dangling refs and orphan nodes

Requirements

  • n8n 2.48.7 with Manual Trigger, Code, If, Set and Merge nodes
  • Declared-schema table: string root and nodes array of {id,type,fields}
  • References as single-field {$ref:id} objects
  • No credentials or external connections; the flow makes no network calls

Setup and testing in n8n

  1. Import the workflow and execute Manual Trigger
  2. Confirm the final output has two items: t1-healthy with valid=true/status=valid and t2-broken with valid=false and error lists
  3. Confirm t2-broken reports duplicateIds=[n3], dangling ref at path missing to nX, unreachableNodeIds=[n3,n4,n5] and two cycles
  4. Edge case: set root='ghost' in a sample and confirm ROOT_TARGET_MISSING names the missing id
  5. Edge case: delete the table field from an item and confirm INPUT_MISSING with nodeCount=0

Service Value

Ready-made workflow template for automation delivery and service execution.

Apps Used

Manual Trigger Code If Set Merge

Details

Trigger Manual trigger
Nodes 8
Apps 5
Views 10
Downloads 1

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (8)

/

Manual Trigger

Manual Trigger

#1

Emit Sample Node Tables

Code

#2

Validate Reference Table

Code

#3

Is Table Valid

If

#4

Valid Table Summary

Set

#5

Invalid Table Report

Set

#6

Merge Report Branches

Merge

#7

Collect Integrity Reports

Code

#8

Stage 1 - Sample Tables

Sticky Note

#9

Stage 2 - Validator

Sticky Note

#10

Stage 3 - Routing and Report

Sticky Note

#11
Stay in the loop

Fresh workflows, straight to your inbox

Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.

  • New workflows
  • Clear overviews
  • Setup guides

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime