Skip to main content
All content collections in Dzaleka Online Services use Zod schemas for type-safe validation and TypeScript support. These schemas are defined in src/content.config.ts.

Understanding Schemas

Each content collection has a schema that defines:
  • Required fields - Must be present in every entry
  • Optional fields - Can be omitted (marked with .optional())
  • Field types - String, number, date, boolean, array, object
  • Enums - Specific allowed values
  • Validation rules - Format requirements and transformations

Services Schema

title
string
required
Service or business name
description
string
required
Brief description of the service
category
string
required
Service category (e.g., “Entrepreneurship & Business”, “Education”, “Healthcare”)
Whether to feature on homepage
verified
boolean
Verification status by platform administrators
URL or path to service logo
image
string
Main service image
contact
object
Contact information
location
object
Physical location details
socialMedia
object
Social media links
tags
array
Array of string tags for categorization
businessHours
array
Structured business hours
status
enum
default:"active"
Current status
lastUpdated
date
Last update timestamp

Events Schema

title
string
required
Event name
description
string
required
Event description
date
date
required
Event start date and time (ISO 8601 format)
endDate
date
Event end date and time for multi-day events
location
string
required
Event venue or location description
category
string
required
Event category (e.g., “Festival”, “Workshop”, “Conference”)
organizer
string
required
Organizing person or entity
status
enum
default:"past"
Event status
Highlight on homepage
image
string
Event poster or main image
contact
object
Organizer contact information
registration
object
Registration details
panelists
array
Event speakers/panelists
tags
array
Array of string tags

Jobs Schema

title
string
required
Job title
organization
string
required
Hiring organization
location
string
required
Job location
type
enum
required
Employment type
category
enum
required
Job category
salary
string
Salary information or range
deadline
date
required
Application deadline (automatically coerced from string)
posted
date
required
Date posted (automatically coerced from string)
status
enum
default:"open"
Job status
Feature on jobs page
skills
array
required
Required skills (array of strings)
contact
object
required
Application contact information
description
string
required
Full job description (markdown content)

Photos Schema

title
string
required
Photo title or story headline
description
string
required
Photo description or story
date
date
required
Date taken (accepts string, number, or Date - automatically transformed)
image
string
required
Image URL or path (must start with ‘/images/’ or be a valid URL)
photographer
object
required
Photographer information
contributor
string
Content contributor identifier
tags
array
Photo tags (array of strings)
Feature in galleries
location
string
Photo location
Additional gallery images (array of string URLs/paths)

Stores Schema

name
string
required
Store name
description
string
required
Store description
type
enum
required
Store type
logo
string
Store logo URL/path
coverImage
string
Cover/banner image
owner
object
required
Owner information
location
object
required
Store location
menu
array
Menu items (for food establishments)
services
array
Services offered (for service-based stores)
paymentMethods
array
Accepted payment methods (array of strings)
deliveryOptions
array
Delivery options (array of strings)
status
enum
default:"pending"
Store status
dateJoined
date
required
Date joined platform (coerced from string)

Marketplace Schema

title
string
required
Listing title
description
string
required
Item/service description
type
enum
required
Listing type
category
string
required
Product/service category
price
string
Price amount
priceType
enum
default:"contact"
Price type
images
array
Product images (array of URLs/paths)
vendor
object
required
Vendor information
status
enum
default:"pending"
Listing status
condition
enum
Item condition (for products)
datePosted
date
required
Posting date (coerced from string)
External purchase link (validated as URL)

Resources Schema

title
string
required
Resource title
description
string
required
Resource description
category
string
required
Resource category
date
date
required
Publication/creation date
author
string
Resource author or creator
thumbnail
string
Thumbnail image
fileType
string
File type (e.g., “pdf”, “doc”, “video”)
fileSize
string
File size (e.g., “748.24 KB”)
downloadUrl
string
Direct download URL
resourceUrl
string
Resource page URL
languages
array
Available languages (array of strings)
Feature on resources page

Additional Schemas

Key fields: title, author, category (enum), duration, level (beginner/intermediate/advanced), videoUrl, externalLink, status
Key fields: name, skill, status, location, category, level, chargeType (free/paid), rate, paymentMethods array, shortDescription
Key fields: artistName, medium, nationality, bio, artisticJourney, specialties array, achievements array, notableWorks array
Key fields: type (individual/group), danceStyles array, festivals array, members array (for groups)
Key fields: title, name, age, country, personImage, content, contact object with social media
Category enum: business-spotlight, announcement, success-story, business-guide, news, educationAdditional fields: businessName, businessOwner, contactInfo
Category enum: legislation, analysis, guide, resourceFields: source, related array

Type Transformations

Date Handling

Most date fields use z.date() or z.coerce.date() which:
  • Accepts ISO 8601 date strings (e.g., 2025-10-30T09:00:00Z)
  • Accepts date-only formats (e.g., 2023-05-01)
  • Automatically converts to JavaScript Date objects
date: 2025-10-30T09:00:00Z

Special Validations

The photos collection has special image path validation:
  • Must start with /images/ for local images, OR
  • Must be a valid URL for external images

Working with Schemas

TypeScript Support

Schemas automatically generate TypeScript types:
import { getCollection } from 'astro:content';

// Fully typed!
const services = await getCollection('services');
services[0].data.title; // string
services[0].data.featured; // boolean | undefined

Validation Errors

Zod will throw detailed errors for invalid data:
ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": ["title"],
    "message": "Required"
  }
]

Next Steps