JSON Schema
The schema is published at a stable address:
https://docs.ananga.ai/schema/funscript.schema.jsonIt follows JSON Schema draft 2020-12 and matches the spec: actions (or an axes array) is required, each action needs at ≥ 0 and pos between 0 and 100, and unknown fields are allowed.
Validate in JavaScript
Section titled “Validate in JavaScript”import Ajv2020 from 'ajv/dist/2020.js';
const schema = await (await fetch('https://docs.ananga.ai/schema/funscript.schema.json')).json();const validate = new Ajv2020({ allErrors: true }).compile(schema);
if (!validate(script)) console.log(validate.errors);Validate in Python
Section titled “Validate in Python”import json, urllib.requestfrom jsonschema import Draft202012Validator
schema = json.load(urllib.request.urlopen('https://docs.ananga.ai/schema/funscript.schema.json'))errors = list(Draft202012Validator(schema).iter_errors(script))What the schema cannot check
Section titled “What the schema cannot check”A schema checks shape, not motion. A script can be valid JSON and still ask a device to move faster than it can, or send points closer together than it accepts. For that, use check() in the library or the checker on ananga.ai.