Custom Validations

Types of custom validations

TypeUse
Pre-built validatorsNo-code uniqueness checks: row uniqueness and multi-column uniqueness.
Custom regular expressionSimple formatting checks (i.e. allowing commas and periods as decimal places, supporting multiple currency symbols).
Validation webhookChecking data against your database, a third party data source, or writing custom validations in the language of your choice.
In-memory code-hookCreating complex, performant custom validations entirely within OneSchema.

Pre-built validators

OneSchema provides pre-built validators that can be added to a template without writing any code. These are configured in the Validations tab of a template.

Row uniqueness

Row uniqueness validation ensures that no two rows in an import are fully identical across all mapped columns, catching duplicate entries before they reach your system.

OptionDescription
Case sensitiveWhether the comparison is case-sensitive. When disabled, "ABC" and "abc" are treated as identical.

To add row uniqueness via the API, create a template hook with:

  • stage: validation
  • type: row-uniqueness
  • params.caseSensitive: true or false

Multi-column uniqueness

Multi-column uniqueness validation ensures that the combination of values across specified columns is unique for each row. This is useful when no single column is a unique identifier, but a composite key (e.g. first name + last name + email) should be unique.

OptionDescription
ColumnsThe list of template column keys whose combined values must be unique.

To add multi-column uniqueness via the API, create a template hook with:

  • stage: validation
  • type: multicolumn-uniqueness
  • params.columns: an array of column key strings (e.g. ["first_name", "last_name", "email"])

Custom regular expression (regex)

OneSchema supports custom regex in SQL format which can be selected in the data validations list when creating a new template column.


Validation webhook

A validation webhook is a way to use an API endpoint to create a custom validator. OneSchema will pass data to a specified endpoint, and it can be validated against a database, a third party data source, or complex logic checks can be performed. OneSchema simply expects a response of errors and warnings.


Validation webhooks are configured on the template to which they apply. To add a webhook to a template, head to your templates page and click Details on the template you want to edit.


Select Validation webhooks in the left sidebar, followed by Add a new validation hook in the center of the screen.

Then enter a name, endpoint, and select which columns to pass through. Optionally set a secret key for HTTP Basic Auth and a batch size.


Then, fill in the relevant fields.

OptionDescription
Validation hook nameThe name of your webhook.
URLThe url to the endpoint which will receive the webhook call.
Template column KeysThe keys of the columns you wish to include with the webhook call. Only selected columns will be sent.
Secret KeyAn optional token used to authenticate the webhook call.
Batch sizeThe number of rows of data to include in each call.

To configure your endpoint on the backend, continue with our guide on validation webhooks.


In-memory code-hook

In-memory code-hooks enable custom validation logic to be written within OneSchema's admin portal without the need to configure a backend webhook endpoint. Some example use cases include merging rows, splitting and merging columns, and custom uniqueness checks.

These hooks are extremely performant and reduce implementation complexity when compared to validation webhooks, allowing the entire validation process to be handled by OneSchema.

Note that in-memory code-hooks cannot make external calls, so if you need to validate against your database or a third-party source, you'll need to use a validation webhook.