Object Schema

Integry uses JSON Schema to define the structure of objects. JSON Schema is a declarative language that allows you to validate, annotate, and describe the structure of JSON data.

Basic Types

JSON Schema supports the following primitive types:

Type
Description
Example

string

Text values

"Hello World"

number

Any numeric value

3.14

integer

Whole numbers only

42

boolean

True or false

true

array

Ordered list of values

[1, 2, 3]

object

Key-value pairs

{"key": "value"}

null

Null value

null

Defining a Simple Object

Here's a basic example of an object schema:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The contact's full name"
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "The contact's email address"
    },
    "age": {
      "type": "integer",
      "minimum": 0
    }
  },
  "required": ["name", "email"]
}

This schema defines an object with three properties where name and email are required.

Examples

Contact Object

Using Enums

Nested Objects

Array of Objects

Annotations

Following keys can be included to provide additional context about the schema:

Keyword
Description

title

A short title for the schema

description

A detailed description

default

Default value if none is provided

examples

Example values

Further Reading

For complete JSON Schema specifications and advanced features like conditional schemas, schema composition (allOf, anyOf, oneOf), and references ($ref), see the official documentation:

Last updated

Was this helpful?