{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Hex words file, version 1", "description": "What a writer must produce (docs/specs/hex-words.md). Readers are more lenient: a file that fails this schema can still be partly read, by the rules in the definition. Not expressible here, and still required of writers: every term, spelling and heard phrase has a letter or digit; terms are unique ignoring case (the key in the definition), spellings are unique within their term and differ from it, heard phrases are unique; text is NFC.", "type": "object", "required": [ "format", "version", "madeBy", "vocabulary", "replacements" ], "additionalProperties": false, "properties": { "format": { "const": "hex.words" }, "version": { "const": 1 }, "madeBy": { "type": "object", "required": [ "app" ], "additionalProperties": false, "properties": { "app": { "$ref": "#/$defs/line", "maxLength": 64, "description": "Hex for Mac, Hex for Windows, Hex for Linux, Hex for iPhone or Hex for Android" }, "version": { "$ref": "#/$defs/line", "maxLength": 32 } } }, "vocabulary": { "type": "array", "maxItems": 500, "items": { "type": "object", "required": [ "term" ], "additionalProperties": false, "properties": { "term": { "$ref": "#/$defs/line", "maxLength": 64 }, "soundsLike": { "type": "array", "minItems": 1, "maxItems": 16, "uniqueItems": true, "items": { "allOf": [ { "$ref": "#/$defs/line" }, { "$ref": "#/$defs/eightWords" } ], "maxLength": 64 } } } } }, "replacements": { "type": "array", "maxItems": 1000, "items": { "type": "object", "required": [ "heard", "write" ], "additionalProperties": false, "properties": { "heard": { "allOf": [ { "$ref": "#/$defs/line" }, { "$ref": "#/$defs/eightWords" } ], "maxLength": 128 }, "write": { "type": "string", "maxLength": 1000, "pattern": "^[^\\u0000-\\u0008\\u000b-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u180e\\u200b\\u200e\\u200f\\u202a-\\u202e\\u2060-\\u2064\\u2066-\\u2069\\ufeff\\ufff9-\\ufffb]*$", "description": "Kept exactly. May be empty (deletes the heard phrase) and may hold line feeds and tabs, never a carriage return." }, "learned": { "const": true, "description": "Written only for a fix Hex learned on a phone; left out otherwise." } } } } }, "$defs": { "line": { "type": "string", "minLength": 1, "pattern": "^[^ \\u0000-\\u001f\\u007f-\\u00a0\\u00ad\\u061c\\u1680\\u180e\\u2000-\\u200b\\u200e\\u200f\\u2028-\\u202f\\u205f-\\u2064\\u2066-\\u2069\\u3000\\ufeff\\ufff9-\\ufffb]+( [^ \\u0000-\\u001f\\u007f-\\u00a0\\u00ad\\u061c\\u1680\\u180e\\u2000-\\u200b\\u200e\\u200f\\u2028-\\u202f\\u205f-\\u2064\\u2066-\\u2069\\u3000\\ufeff\\ufff9-\\ufffb]+)*$", "description": "Cleaned one-line text: no leading, trailing or double spaces, no other whitespace, no hidden characters." }, "eightWords": { "type": "string", "pattern": "^[^ ]+( [^ ]+){0,7}$" } } }