Schema for structured content

If you wish to use Experience Workspace's structured content feature, you need to define a schema for your structured data. Schemas are the foundation of structured content. They define what fields are available, what types of data they accept, and how they're organized. Structured content schemas in Experience Workspace adhere to a subset of JSON Schema 2020-12. Anything outside the subset is ignored.

Read the full specification before creating a schema. The complete, authoritative, and always-current reference is found in the da-sc-sdk repository at schema-spec.md. It defines the exact authoring rules, the supported types, the presentation annotations and validation constraints, how $defs / $ref reuse works, and the empty-value semantics that decide what ends up in the delivered JSON.

Here are a few important points to keep in mind as you read the specification.:

Example schema

This example coffee schema models a Coffee Product. The schema demonstrates most of the supported features of structured content in Experience Workspace: strings with length and pattern constraints, numbers and integers with bounds, enum drop downs, a boolean, an array of primitives, a nested object, and a reusable $def referenced via $ref.

{
  "$defs": {
    "Faq": {
      "type": "object",
      "title": "FAQ",
      "required": [
        "question"
      ],
      "properties": {
        "question": {
          "type": "string",
          "title": "Question"
        },
        "answer": {
          "type": "string",
          "title": "Answer"
        }
      }
    }
  },
  "type": "object",
  "title": "Coffee Product",
  "required": [
    "name",
    "slug",
    "price",
    "status"
  ],
  "properties": {
    "name": {
      "type": "string",
      "title": "Product Name",
      "minLength": 2,
      "maxLength": 80
    },
    "slug": {
      "type": "string",
      "title": "Slug",
      "minLength": 3,
      "maxLength": 60,
      "pattern": "^[a-z0-9-]+$"
    },
    "description": {
      "type": "string",
      "title": "Description",
      "maxLength": 400
    },
    "category": {
      "type": "string",
      "title": "Category",
      "enum": [
        "Bagged Coffee",
        "Coffee Pods",
        "Coffee Machines",
        "Bundles",
        "Accessories"
      ],
      "default": "Bagged Coffee"
    },
    "roastLevel": {
      "type": "string",
      "title": "Roast Level",
      "enum": [
        "Light",
        "Medium",
        "Medium-Dark",
        "Dark"
      ],
      "default": "Medium"
    },
    "origin": {
      "type": "string",
      "title": "Origin"
    },
    "price": {
      "type": "number",
      "title": "Price",
      "minimum": 0
    },
    "currency": {
      "type": "string",
      "title": "Currency",
      "enum": [
        "USD",
        "EUR",
        "GBP"
      ],
      "default": "USD"
    },
    "weightGrams": {
      "type": "integer",
      "title": "Bag Weight (g)",
      "minimum": 0
    },
    "status": {
      "type": "string",
      "title": "Status",
      "enum": [
        "Draft",
        "Active",
        "Discontinued"
      ],
      "default": "Draft"
    },
    "inStock": {
      "type": "boolean",
      "title": "In Stock",
      "default": true
    },
    "rating": {
      "type": "number",
      "title": "Average Rating",
      "minimum": 0,
      "maximum": 5
    },
    "tastingNotes": {
      "type": "array",
      "title": "Tasting Notes",
      "minItems": 1,
      "maxItems": 10,
      "items": {
        "type": "string",
        "title": "Note"
      }
    },
    "brewing": {
      "type": "object",
      "title": "Brewing Guide",
      "properties": {
        "method": {
          "type": "string",
          "title": "Recommended Method"
        },
        "ratio": {
          "type": "string",
          "title": "Coffee-to-Water Ratio"
        },
        "temperature": {
          "type": "integer",
          "title": "Water Temperature (°C)",
          "minimum": 0,
          "maximum": 100
        }
      }
    },
    "faqs": {
      "type": "array",
      "title": "FAQs",
      "items": {
        "$ref": "#/$defs/Faq"
      }
    }
  }
}

Resulting JSON

This is a sample of possible resulting JSON of a document created based on the example coffee schema.

{
  "name": "Morning Muse Light Roast",
  "slug": "morning-muse-light-roast",
  "description": "A bright, citrusy light roast with a smooth finish—a perfect start to any day.",
  "category": "Bagged Coffee",
  "roastLevel": "Light",
  "origin": "Yirgacheffe, Ethiopia",
  "price": 16.5,
  "currency": "USD",
  "weightGrams": 340,
  "status": "Active",
  "inStock": true,
  "rating": 4.7,
  "tastingNotes": ["citrus", "floral", "smooth finish"],
  "brewing": { "method": "Pour-over (V60)", "ratio": "1:16", "temperature": 94 },
  "faqs": [
    { "question": "Is this coffee whole bean or ground?", "answer": "It ships as whole bean by default; choose your grind at checkout." },
    { "question": "How fresh is it?", "answer": "Every bag is roasted to order and shipped within 48 hours." }
  ]
}