Contracts

Contracts describe what a valid vendor file looks like. When a pipeline runs, VendorGate compares the incoming file against the contract and reports any violations. This lets you catch bad data before it reaches downstream systems.

What a contract contains

A contract has several main parts:

  • Source format: how the incoming file should be parsed, such as CSV, TSV, Excel sheet, JSON, XML, fixed-width, API, or database.
  • Columns: the fields the file must contain and their expected data types.
  • File rules: structural checks such as row count, file size, forbidden columns, and whether extra columns are allowed.
  • Rules: business validations applied to values, rows, or the file as a whole.
  • Statistics and anomaly rules: measurements across the file and thresholds for unexpected changes between runs.
  • Decision rules: how severity levels are translated into pass, review, or fail outcomes.

Column validation

For each column you can specify:

  • Name
  • Data type: string, integer, decimal, boolean, date, datetime, time, email, url, uuid, or json
  • required: whether the column must appear in the source header
  • nullable: whether cells may be empty or null
  • Format options such as date patterns, true/false value mappings, or maximum length, where applicable

Rule types

Rules let you express conditions that go beyond simple column types.

Value checks

  • Minimum or maximum value
  • Value between two bounds
  • Not equal to a specific value
  • Allowed or disallowed values

Format and length checks

  • Regular expression pattern
  • Valid email, URL, or date
  • Starts with, ends with, contains, or does not contain a value
  • Minimum or maximum length

Uniqueness and relationship checks

  • Unique values in a single column
  • Composite unique values across multiple columns
  • Consistency within a group
  • Sequence checks
  • Balance checks, such as debits equaling credits
  • Duplicate-row detection
  • Distinct-value limits

Expression and reference checks

  • Evaluate a custom expression against fields in the same row.
  • Check that a value exists in a lookup dataset.
  • Check that a value does not exist in a lookup dataset.

File-level checks

  • Minimum or maximum row count
  • Minimum or maximum file size
  • Forbidden columns
  • Whether extra columns are allowed

Statistics and anomaly detection

You can compute statistics such as row count, averages, null percentages, and standard deviations. Statistics can also be computed from expressions. You can then define anomaly rules or statistic-expression rules that flag unexpected values or changes between runs.

Applying a contract

When you create or edit a pipeline, select the contract that should validate the source file. If the file fails validation, the pipeline run is marked as failed and the errors are recorded in the run details.

Testing a contract

You can test a contract against a sample file without running a full pipeline. Upload the sample in the contract builder and review the validation report. This is the fastest way to refine rules before putting them into production.

Example

A simple invoice contract might require:

  • invoice_id: string, required, unique
  • supplier_id: string, required
  • invoice_date: date, required
  • amount: decimal, required, greater than zero
  • currency: string, required, one of USD, EUR, GBP