Configuring Custom Validations

Types of custom validations

TypeUse
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.

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 add validation hook in the upper right, followed by create hook on the bottom right of the pop-up window.



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.


[BETA] 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 multi-column 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.