n8n Webhook Mapping Guard by Shivansh Jainn8n Webhook Mapping Guard by Shivansh Jain

n8n Webhook Mapping Guard

Shivansh Jain

Shivansh Jain

Two input shapes, one explicit order contract. An AI-assisted, self-initiated demo tested on n8n 2.46.6.
A string containing “false” should not become true. An amount such as “12.345” should not quietly round into an order total. And a missing nested object should produce a useful validation error.
I built Webhook Mapping Guard as an AI-assisted, self-initiated n8n demonstration using synthetic order data. It takes two explicitly selected input shapes, nested or flat, and returns one consistent order format or a structured rejection.
The build
The workflow uses Webhook → Normalize and Validate → IF → Respond to Webhook. Accepted orders return HTTP 200. Invalid orders return HTTP 422 with field-level error codes and no partial order data.
The JavaScript normalizer:
Maps only the fields defined in the output contract.
Parses bounded decimal strings into integer minor units, without rounding extra decimal places.
Handles boolean values and the strings “true” and “false” explicitly.
Checks IDs, basic email shape, currency, and required containers before returning an order.
Uses the selected schema without guessing between field aliases.
The proof
The same 49 unique fixtures passed at each of three layers: direct JavaScript checks, native n8n execution, and real loopback HTTP requests. They cover 14 accepted inputs and 35 rejected inputs. Two additional transport checks confirmed malformed JSON returned 422 and GET on the POST-only webhook returned 404.
Testing also caught a transport detail: n8n 2.46.6 turns a JSON null request body into an empty object before the Code node. Direct null input returns OBJECT_REQUIRED; the HTTP path returns UNSUPPORTED_SCHEMA. Both reject the input. The fixture records that difference explicitly, and the evidence retains the earlier mismatch.
The retained evidence includes two inactive workflows, the readable normalizer, fixtures, reproduction scripts, per-case results, and checksums.
Scope
This is a synthetic demonstration, not a customer implementation. Verification covers n8n 2.46.6 with Node.js 24.22.1 in an isolated local runtime. The amount contract accepts decimal strings from 0 through 99,999,999.99 and supports USD, EUR, and GBP only. Email checks cover basic shape, not deliverability.
The webhook has no authentication or signature verification and must not be exposed publicly as-is. Retries, idempotency, downstream integrations, concurrent load, other n8n versions, and production or business outcomes were not verified.
Applying the approach
For a real repair, first agree the source schema, validation policy and acceptance tests. This multi-node demonstration is not automatically included in a one-failure repair scope.
Like this project

Posted Nov 6, 2026

Synthetic n8n 2.46.6 webhook demo: 49 fixtures across JavaScript, native and HTTP tests. Explicit 200/422 results. Isolated, no authentication.