Dollie Editor SDK guide

Validation

Reject unknown components and malformed structured content.

Validate imported, AI-proposed, and user-edited definitions against the catalog allowed for that page.

import { validatePageConfig } from "@dollie_ai/editor";

const result = validatePageConfig(definition, catalog, {
  sections: sectionDefinitions,
});

if (!result.valid) {
  console.error(result.errors);
}

What structural validation checks

The current validator checks:

  • that sections is an array;
  • that each section contains a component id;
  • that the component exists in the catalog;
  • that section props are objects;
  • that themes, borders, dividers, and additional class names use supported values;
  • that element slots contain allowed element kinds;
  • that registered element ids exist.

What the host must also check

Structural validation does not replace product validation. Your server may also need to enforce:

  • tenant and user permissions;
  • field length and content policies;
  • safe URLs and asset ownership;
  • allowed dynamic data sources;
  • required sections;
  • plan or feature limits;
  • publishing and approval rules.

Run server-side validation with the same catalog allowlist used by the editor.

Validate before applying AI output

AI output is a proposal, not trusted application state:

const result = validatePageConfig(proposal, catalog, {
  sections: sectionDefinitions,
});

if (result.valid) {
  editor.replaceAll(proposal);
}

Show validation errors to the user or Copilot in language that helps correct the proposal.