Validation playground
Edit the story below. validateStory runs on every keystroke and reports each problem with a JSON Pointer to the field that caused it.
The story starts out broken on purpose. Try fixing it: correct the typo in goto, rename the duplicate id, make at positive, move the hotspot inside the frame, and give the polygon at least three points.
5 problems found
/scenes/intro/events/0/atinvalid_value/scenes/intro/events/0/options/0/gotomissing_scene/scenes/intro/events/1/idduplicate_id/scenes/intro/events/1/areainvalid_value/scenes/intro/events/2/pointsmissing_geometry
Code
ts
import { validateStory } from "@ivkit/core";
const result = validateStory(JSON.parse(text));
if (result.valid) {
player.story = result.story;
} else {
for (const { path, code, message } of result.errors) {
console.error(`${path} (${code}): ${message}`);
}
}See Validating stories for every error code.