Skip to content

Developers · Data

Server-Side Validation

Last updated 2 November 2026

Data integrity is critical to any business or project. There are various ways to design systems with robust data integrity, and one of the most basic ways is to implement data validation. In Insites, server-side validation can be done in 2 ways: Forms and GraphQL.

Forms

Insites form validations are only triggered after submission. When a field/data does not meet the 'requirements' set on the server, it will stop the process and return the error via the context.flash liquid tag.

More information about Insites form validation and error handling:

GraphQL

Form validation also works when we use it on a graphQL mutation. Simply add form_name on your mutation, referring to the form it will reference. If there are validation errors encountered on the graphQL, it will return the form’s error as part of the graphQL data response.

Sample model schema:

name: sample_model
properties:
- name: email
  type: string
- name: title
  type: string
- name: details
  type: string

Sample model form configuration:

---
name: sample_form
resource: sample_model
resource_owner: anyone
fields:
  properties:
    title:
      validation:
        presence:
          message: Title is a required field.
    details:
      validation:
        presence:
          message: Details is a required field.
---

Sample graphQL mutation with form reference:

mutation sample_mutation ($id: ID!, $form_name: String!, $properties: [PropertyInputType]) {
 record_update (
   id: $id, ## ID of the data to be mutated
   form_name: $form_name ## This is your form reference, for example sample_form
   record: {
     properties: $properties ## These are your fields and values, for example title and details
   }
 ) {
   id
   created_at
   updated_at
   deleted_at
   properties
 }
}

Pass the form name in and the fields in , as a list of objects that each have a and a .

Important: Once you relate a form to a graphQL, regardless if your graphQL fields passed, it will only process fields / data defined on your form. If we reuse the previous form example for the graphQL below, it will not process an email entry in , because the ‘email’ field does not exist on the form configuration.

mutation sample_mutation (
   $id: ID!,
   $form_name: String!,
   $properties: [PropertyInputType]
) {
 items: record_update (
   id: $id
   form_name: $form_name
   record: {
     properties: $properties ## an email entry here will not be updated, because the form configuration does not have this field
   }
 ) {
   id
   created_at
   updated_at
   deleted_at
 properties
 }
}