This repo includes a JSON Schema and an example to power a node-based editor and a play feature for a scavenger hunt app.
- Schema: schema/scavenger.schema.json
- Example: examples/scavenger.sample.json
- version: Semver string for the file format.
- metadata: Title, description, author, timestamps.
- settings: Gameplay settings (start puzzle, time limit, hints, scoring).
- puzzles: Array of puzzle nodes with type, text, API config (if needed), success conditions, hints, rewards, and editor position.
- edges: Directed connections between puzzles for the node editor, with optional conditions.
- passcode:
success.codeslist, withcaseSensitive,ignoreWhitespace,attemptsAllowed,normalize. - reorder:
success.tokens(optional),success.targetOrder,orderMatters. - multipleChoice:
success.choices(id/text),success.correctIds,minSelect,maxSelect,orderMatters. - regex:
success.pattern,flags. - api:
apiblock (url, method, headers/query/body, timeout),success.expectwith JSONPathpath,operator(equals/contains/matches/gt/lt/gte/lte),value,requireAll. - location:
success.lat,success.lon,radiusMeters. - qr:
success.codeslist.
Each puzzle has title, description, optional ui (input type, placeholder), optional hints and reward, and a position {x,y} for the node-based editor.
- Copy examples/scavenger.sample.json and customize.
- Keep
puzzle.typealigned with thesuccessshape described above. - Connect puzzles via
edgesusing puzzleids.
You can validate your JSON against the schema using ajv-cli:
npx ajv-cli validate -s schema/scavenger.schema.json -d examples/scavenger.sample.jsonIf you prefer installing locally:
npm install --save-dev ajv ajv-cli
npx ajv-cli validate -s schema/scavenger.schema.json -d examples/scavenger.sample.json- For
apipuzzles, thequeryorbodycan include placeholders like{playerInput}; your app can substitute runtime values before calling. edges.condition.typedefaults toonSuccess. You can extendcustomfor bespoke gating.