LogoLogo
Visit Contextual.ioSign Up
  • Getting Started
    • Welcome
    • Tour: Hello, AI World!
  • TRAINING
    • Basic Developer Training Course
      • Lesson 1: HTTP Agent Introduction
      • Lesson 2: Logging and Error Handling Basics
      • Lesson 3: Event Processing Agent Introduction
  • Services Catalog
    • What's in the Catalog?
      • Intro Patterns
      • Object Type Bundles
    • Browse by Platform
    • All Intro Patterns
      • Anthropic Claude Image Analysis
      • Mistral AI Prompt and Response
      • xAI Grok Prompt and Response
      • DeepSeek Chat Prompt and Response
      • Qwen Chat Prompt and Response
      • Perplexity AI Search and Response
      • Firecrawl Website Scraper
      • Groq Prompt and Response
      • Nyckel Dog Breed Classification
      • RapidAPI ClassifyAI Text Classification
      • RapidAPI YouTube AI Video Summary
      • UnifyAI Model Comparison
      • WebPilot URL Analysis and Summarization
      • OpenAI Assistants Prompt and Response
      • OpenAI Sync
    • All Prebuilt Solutions
      • Invoice AI
      • Lead Generation Form
    • All Object Type Bundles
      • Work Order Management System ITIL Object Type Bundle
        • Work Order
        • User
        • Role
        • Permission
        • Asset
        • Task
        • Action
        • Attachment
        • Comment
        • Notification
        • Audit Log
        • Service Level Agreement
        • Custom Fields
        • Work Order Template
        • Work Order Transition
        • Escalation Policy
        • Tag
  • Components & Data
    • Object Types
      • Data in Contextual
        • Secrets
        • Validation
        • Versioning
      • Examples
      • Creating an Object Type
      • Object Type Details
        • Definition
        • Data Schema
          • Automatic Record Metadata
          • Generated Values
            • Dates and Times
            • UUIDs
          • Frequently Used Validation
          • Disallowing Null Property Values
          • Disallowing Undefined Properties
          • Secrets
          • AI Assistant
          • ID and PrimaryKey Permanence
        • UI Schemas
        • Features
        • Triggers
        • Actions
        • Audit Trail
        • Versions
        • Templates
        • Records
      • Using Object Types in Flows
      • Records
        • Records and Your Tenant API
        • Record Import
    • Flows
      • Nodes
      • Wires
      • Message Object
      • Flow Editor
        • Basics
        • Saving Changes
        • In-Flow Testing with Debugger
        • Restart Agents to Make Changes Active
        • Config
      • Node Reference
        • Common
          • Log Tap
          • Inject
          • Debug
          • Complete
          • Catch
          • Status
          • Link In
          • Link Call
          • Link Out
          • Comment
        • Event
          • Prepare Event
          • Event Start
          • Event End
          • Event Error
        • Object
          • Search Object
          • Get Object
          • Create Object
          • Patch Object
          • Put Object
          • Delete Object
          • Run Action
        • Request
          • Send to Agent
          • HTTP GET
          • HTTP PATCH
          • HTTP PUT
          • HTTP DELETE
          • HTTP POST
          • GQL
          • Produce Message
        • Function
          • Function
          • Switch
          • Change
          • Range
          • Template
          • Delay
          • Trigger
          • Exec
          • Filter
          • Loop
        • Models
          • ML Predict
        • Network
          • MQTT In
          • MQTT Out
          • HTTP In
          • HTTP Response
          • HTTP Request
          • WebSocket In
          • WebSocket Out
          • TCP In
          • TCP Out
          • TCP Request
          • UDP In
          • UDP Out
        • Sequence
          • Split
          • Join
          • Sort
          • Batch
        • Parser
          • csv
          • html
          • json
          • xml
          • yaml
    • Agents
      • Creating an Agent
      • Types of Agents
        • Event to Flow
        • HTTP to Flow
          • Custom Domains
      • How Agents Work
        • Flow Execution
        • HTTP Load Balancing
        • Event Routing
      • Scale and Performance
        • Flow execution
        • Parallel Instances
        • Event Lag Scaling
        • Compute Threshold Scaling
        • Instance Compute Sizing
      • Agent Details
        • Definition
        • Operations
        • Logs
          • Session Log
          • Message Log
        • Audit Trail
        • Versions
      • Using Agents in Flows
    • Connections
      • Creating a Connection
      • Types of Connections
        • Basic
        • Bearer
        • Client Grant
        • Kafka
        • Password Grant
        • Public
        • Pulsar
      • Using Connections in Flows
    • JWKS Profiles
      • Using JWKS Profiles in Your Solution
  • PATTERNS
    • Solution Architecture
      • Events, Messages, Queues
    • Working with Data
      • Search Object Node & Pagination
      • Message Payload Content - Triggers and Actions
    • Industry Cookbooks
      • Field Services
  • Tenants
    • Tenant Workspace
    • Tenant Logs
      • Contextual Log Query Language (CLQL)
        • String Searches
        • Keyword Searches
        • Advanced Operators
    • Tenant API
      • API Keys
        • API Key Settings
        • API Key Permissions
      • Documentation
  • Release Notes
    • 2024
      • 2024.12.09
Powered by GitBook
On this page

Was this helpful?

  1. Components & Data
  2. Object Types

Examples

PreviousVersioningNextCreating an Object Type

Last updated 12 months ago

Was this helpful?

The is the essence of your . Created using JSON, Data Schemas can be as simple or complex as your needs demand. Several examples of this powerful Contextual capability are provided.

An example of a Customer Object Type typical to a simple business or CRM system.

Object Type Definition
Value

ID

customer

Display Name

Customer

Display Name (Plural)

Customers

Description

Customers of my company.

Category

Data

prompts you might consider to modify this schema:

  • "Add validation to the zip property"

  • "Instead of separate name fields, combine into a single fullName field"

  • "Add validation to the phone property so it meets US standard"

  • "Add a description to each property"

Example Data Schema
{
  "primaryKey": "customerId",
  "type": "object",
  "properties": {
    "customerId": {
      "type": "string",
      "generate": {
        "type": "uuid",
        "format": "v4"
      }
    },
    "firstName": {
      "type": "string",
      "minLength": 1
    },
    "lastName": {
      "type": "string",
      "minLength": 1
    },
    "email": {
      "type": "string",
      "format": "email",
      "minLength": 1
    },
    "phone": {
      "type": "string",
      "minLength": 1
    },
    "address": {
      "type": "object",
      "properties": {
        "street": {
          "type": "string",
          "minLength": 1
        },
        "city": {
          "type": "string",
          "minLength": 1
        },
        "state": {
          "type": "string",
          "minLength": 1
        },
        "zip": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "street",
        "city",
        "state",
        "zip"
      ]
    }
  },
  "required": [
    "firstName",
    "lastName",
    "email",
    "phone",
    "address"
  ],
  "additionalProperties": false
}

This schema defines an object for storing customer data, using customerId as the primary key, which is generated as a UUID version 4 string. The schema includes properties such as firstName, lastName, email (which must be a valid email format), and phone, each requiring a minimum length of one character. It also details an address object with mandatory properties like street, city, state, and zip, each also requiring a minimum length of one. All these properties are required for the object to be valid. Additionally, the schema disallows any properties not explicitly defined (additionalProperties is set to false).

An example of an Invoice Object Type, typical to a simple business or CRM system.

Object Type Definition
Value

ID

invoice

Display Name

Invoice

Display Name (Plural)

Invoices

Description

Invoices for my services.

Category

Data

  • "Add validation to the zip property"

  • "Add state names and 2-letter abbreviations to the state property"

  • "Add validation to the phone property so it meets US standard"

  • "Add a description to each property"

Example Data Schema
{
  "primaryKey": "invoiceId",
  "type": "object",
  "properties": {
    "invoiceId": {
      "type": "string",
      "generate": {
        "type": "uuid",
        "format": "v4"
      }
    },
    "clientName": {
      "type": "string",
      "minLength": 1
    },
    "clientAddress": {
      "type": "object",
      "properties": {
        "street": {
          "type": "string",
          "minLength": 1
        },
        "city": {
          "type": "string",
          "minLength": 1
        },
        "state": {
          "type": "string",
          "minLength": 1
        },
        "zip": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "street",
        "city",
        "state",
        "zip"
      ]
    },
    "consultantName": {
      "type": "string",
      "minLength": 1
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "hours": {
      "type": "number",
      "minimum": 1
    },
    "hourlyRate": {
      "type": "number",
      "minimum": 1
    },
    "totalAmount": {
      "type": "number",
      "minimum": 1
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "sent",
        "paid",
        "overdue"
      ]
    }
  },
  "required": [
    "clientName",
    "clientAddress",
    "consultantName",
    "date",
    "hours",
    "hourlyRate",
    "totalAmount",
    "status"
  ],
  "additionalProperties": false
}

This schema defines an object for an invoice, using invoiceId as the primary key, which is generated as a UUID version 4 string. It includes properties such as clientName, clientAddress (an embedded object with required properties like street, city, state, and zip), consultantName, date (in date format), hours (a number with a minimum of 1), hourlyRate (also a number with a minimum of 1), totalAmount (a number with a minimum of 1), and status (restricted to "draft", "sent", "paid", or "overdue"). All properties listed are required, and no additional properties are allowed outside those defined.

An example of a ZIP Code Object Type which could be used to store a record of every ZIP Code in the United States, and associated geo-location information.

Object Type Definition
Value

ID

zipcode

Display Name

ZIP Code

Display Name (Plural)

ZIP Codes

Description

ZIP Codes throughout the United States.

Category

Setting

  • "Add arrays for the cities, states, and counties associated with each ZIP code"

  • "Add a description to each property"

Example Data Schema
{
  "primaryKey": "zipCode",
  "type": "object",
      "properties": {
        "zipCode": {
          "description": "Postal code",
          "type": "string",
          "pattern": "^\\d{5}(?:[-\\s]\\d{4})?$"
      }
  },
  "required": [
    "zipCode"
  ],
  "additionalProperties": false
}

This schema defines an object that primarily uses zipCode as its unique identifier. The zipCode is a required property, characterized by the type "string" and must follow a specific pattern. The acceptable format for the zipCode is either a five-digit number or a five-digit number followed by a dash or space and then four additional digits (e.g., 12345 or 12345-6789). The schema restricts any properties other than those explicitly defined (additionalProperties is set to false), emphasizing that the only data this schema will accept pertains to the zipCode.

An example of a Freeform Object Type which simply creates a unique ID and records any valid JSON properties and values that are provided.

Object Type Definition
Value

ID

freeform

Display Name

Freeform

Display Name (Plural)

Freeform

Description

Uniquely identified records of various schema shapes.

Category

Data

Example Data Schema
{
  "primaryKey": "id",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "generate": {
        "type": "uuid",
        "format": "v4"
      }
    }
  }
}

This schema defines a simple object where the primary key is id. The id is a string that is automatically generated as a UUID version 4. The schema specifies only this one property, focusing solely on the identifier for the object. Notably, the schema does not restrict additional properties, meaning it will allow any data posted to be processed alongside the id.

prompts you might consider to modify this schema:

prompts you might consider to modify this schema:

Data Schema
Object Type
AI Assistant
AI Assistant
AI Assistant