delvewright-dsl
The campaign format that the delvec
compiler reads: Rust types, validation, a canonical writer, and JSON Schema
export for the staged JSON documents that describe a Minecraft Java Edition
1.21.11 adventure map.
A campaign is six documents — world, npcs, classes, quest-plan,
quests, dialogue — plus an optional world-edits script and one
l10n/<code>.json sidecar per translated language. Each is an envelope
{ dsl_version, campaign_id, stage, content } wrapping that stage's payload.
Later stages reference earlier ones and never the other way round, so a campaign
can be written and checked one stage at a time.
The JSON Schemas are generated from the Rust types, so the schema a document is authored against and the parser that reads it cannot disagree.
Use
[]
= "0.37"
use ;
// Six JSON strings in, diagnostics out.
let raw = RawCampaign ;
let diagnostics = check_campaign; // parse, then validate
// Or in two steps.
let campaign = parse_campaign?;
let diagnostics = validate_campaign;
// The schema for stage 1, as serde_json::Value.
let schema = stage_schema;
What it provides
- Types — every stage payload as serde structs, all
#[serde(deny_unknown_fields)], so a typo is a diagnostic rather than a silently ignored key. Ids are type-prefixed kebab-case newtypes (area/…,npc/…,class/…,quest/…,obj/…,dlg/…,anchor/…,prefab/…). - Validation —
validate_campaignreturnsDiagnostic { code, severity, stage, path, message }, one stableDW####code per rule: id syntax and uniqueness, dangling and forward references, dialogue reachability, quest-graph cycles, cross-stage completeness, item and entity ids, translation coverage.validate_campaign_withtakes registries so ids resolve against a real Minecraft registry and a real prefab library. - Canonical form —
to_canonical_stringandfmt: two-space indent, sorted map keys, declaration field order, one trailing newline. Array order is semantic and is never reordered. Round-tripping a valid document is byte-identical, so an edit is a small diff instead of a whole-file rewrite. - JSON Schema —
stage_schemaexports one full-envelope draft 2020-12 schema per stage. - Registries —
ItemRegistry,EntityRegistry,BlockRegistry,EffectRegistryandAnchorRegistrytraits, with small vendored implementations so the crate validates standalone, and injection points for the full ones.
All iteration is over ordered collections: nothing depends on hash order, wall-clock time, or absolute paths.
Compatibility
- Campaign format:
dsl_version0.37.0, the one number this crate accepts; any other is refused at the envelope. - Minecraft: Java Edition 1.21.11.
- Rust: 1.97.1 or newer.
Documentation
- Format reference
— every stage's fields, every verb, and the complete
DW####catalogue. - Project repository.
Licence
GPL-3.0-only.