Skip to main content

Schema Validation

Source file: examples/schema_object_validation.hen

What It Demonstrates

  • collection-local declarations
  • nested schema declarations
  • built-in scalar checks such as UUID, EMAIL, URI, and DATE_TIME
  • schema assertions with ===

Key Pattern

schema Author {
id: UUID
name: string
email: EMAIL
avatar: URI
}

schema Article {
slug: string
title: string
subtitle?: string
image: URI
author: Author
content: string
dateCreated: DATE_TIME
}

^ & body === Article

Run It

hen verify ./examples/schema_object_validation.hen
hen run ./examples/schema_object_validation.hen 0 --non-interactive

What To Notice

  • The declarations live in the collection preamble before the first ---.
  • The assertion stays concise even when the object shape is nested.
  • Use the schema examples together with the scalar and root-array examples in examples/ when you need deeper coverage.

Related reference: Schemas