Skip to main content
Orionjs schemas can be serialized and sent to the client for use in form validation, GraphQL introspection, and more.

Basic Serialization Example

The output will be a JSON representation of the schema:

Using Serialized Schemas in the Client

You can use the serialized schema for client-side validation in frontend applications:
On the client side, you can use this schema with form libraries or build custom validation:

Schema Serialization with Nested Schemas

When a schema includes nested schemas, these will also be serialized:

Key Benefits

  1. Consistent validation rules across server and client
  2. DRY principle - define schema once, use everywhere
  3. Type safety throughout your application
  4. Better UX - validate forms before submission

Performance Tips

  • Cache serialized schemas to avoid redundant processing
  • Only serialize fields needed for client validation
  • Consider security implications of exposing validation rules