SchemaEditor - Types and Formats
JSON Schema Types
Section titled “JSON Schema Types”String
Section titled “String”Text data of any length.
{ type: 'string'}Use for: Names, descriptions, text fields, IDs
Common formats:
date,time,date-time- Temporal dataemail- Email addressesuri- URLs and URIsuuid- Unique identifiers
Number
Section titled “Number”Numeric values, including decimals.
{ type: 'number'}Use for: Prices, measurements, percentages, coordinates
Validation options:
minimum/maximum- Range constraintsmultipleOf- Must be multiple of value
{ type: 'number', minimum: 0, maximum: 100, multipleOf: 0.01 // Two decimal places}Integer
Section titled “Integer”Whole numbers only, no decimals.
{ type: 'integer'}Use for: Counts, quantities, IDs, ages, years
Validation options: Same as number
{ type: 'integer', minimum: 0, maximum: 150}Boolean
Section titled “Boolean”True or false values.
{ type: 'boolean'}Use for: Flags, toggles, yes/no questions
Object
Section titled “Object”Nested objects with their own properties.
{ type: 'object', properties: { street: { type: 'string' }, city: { type: 'string' }, zipCode: { type: 'string' } }, required: ['street', 'city']}Use for: Complex structured data, nested entities
Additional options:
properties- Define nested propertiesrequired- List of required property namesadditionalProperties- Allow/disallow extra properties
Lists of items, all of the same type.
{ type: 'array', items: { type: 'string' }}Use for: Lists, collections, tags, multiple selections
Validation options:
items- Schema for array elementsminItems/maxItems- Length constraintsuniqueItems- Require unique elements
{ type: 'array', items: { type: 'string', format: 'email' }, minItems: 1, maxItems: 5, uniqueItems: true}Explicit null values.
{ type: 'null'}Use for: Optional fields that can be explicitly null
Often combined with other types:
{ type: ['string', 'null'] // Can be string or null}String Formats
Section titled “String Formats”Date and Time
Section titled “Date and Time”Full date in ISO 8601 format: YYYY-MM-DD
{ type: 'string', format: 'date' }// Example: "2024-01-15"Time of day: HH:MM:SS or HH:MM:SS.sss
{ type: 'string', format: 'time' }// Example: "14:30:00"date-time
Section titled “date-time”Combined date and time with timezone: ISO 8601
{ type: 'string', format: 'date-time' }// Example: "2024-01-15T14:30:00Z"Identifiers
Section titled “Identifiers”Email address format
{ type: 'string', format: 'email' }// Example: "user@example.com"UUID/GUID identifier
{ type: 'string', format: 'uuid' }// Example: "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"Uniform Resource Identifier
{ type: 'string', format: 'uri' }// Example: "https://example.com/path"hostname
Section titled “hostname”DNS hostname
{ type: 'string', format: 'hostname' }// Example: "www.example.com"Network
Section titled “Network”IPv4 address
{ type: 'string', format: 'ipv4' }// Example: "192.168.1.1"IPv6 address
{ type: 'string', format: 'ipv6' }// Example: "2001:0db8:85a3:0000:0000:8a2e:0370:7334"json-pointer
Section titled “json-pointer”JSON Pointer reference
{ type: 'string', format: 'json-pointer' }// Example: "/path/to/property"Regular expression pattern
{ type: 'string', format: 'regex' }// Example: "^[a-zA-Z0-9]+$"Format Selection Logic
Section titled “Format Selection Logic”In SchemaEditor:
- Type = string: All formats available
- Type = number/integer: No formats (formats are for strings)
- Type = boolean/null: No formats
- Type = object/array: No formats (structure defines validation)
Custom Formats
Section titled “Custom Formats”Extend with custom format validators:
const customFormats = { 'phone': /^\+?[1-9]\d{1,14}$/, 'postal-code': /^[A-Z0-9]{3,10}$/, 'credit-card': /^\d{13,19}$/};Register custom formats with your JSON schema validator library.
Type Recommendations
Section titled “Type Recommendations”| Data | Recommended Type | Format |
|---|---|---|
| Person name | string | - |
| Email address | string | |
| Birth date | string | date |
| Created timestamp | string | date-time |
| User ID | string | uuid |
| Age | integer | - |
| Price | number | - |
| Quantity | integer | - |
| Is active | boolean | - |
| Tags | array of string | - |
| Address | object | - |
| Settings | object | - |
| Phone number | string | custom: phone |
Migration Between Types
Section titled “Migration Between Types”When changing a property’s type in SchemaEditor:
- string → number: Existing string values must be numeric
- number → integer: Decimals will be truncated
- any → array: Wraps value in array
- any → object: Creates object with original value
- array/object → primitive: May lose data
Always validate data after type changes.