Files
jp-editor/schema/jianpu.schema.json
2026-09-22 16:33:35 +08:00

284 lines
12 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://jianpu.local/schema/jianpu.schema.json",
"title": "JPW7 Web Editor Project",
"type": "object",
"additionalProperties": false,
"required": ["format", "schemaVersion", "projectId", "source", "score"],
"properties": {
"format": { "const": "jianpu-web" },
"schemaVersion": { "const": 1 },
"projectId": { "type": "string", "minLength": 1 },
"source": { "anyOf": [{ "$ref": "#/$defs/source" }, { "type": "null" }] },
"score": { "$ref": "#/$defs/score" }
},
"$defs": {
"range": {
"type": ["object", "null"],
"additionalProperties": false,
"required": ["start", "end", "line", "column", "endLine", "endColumn", "byteStart", "byteEnd"],
"properties": {
"start": { "type": "integer", "minimum": 0 },
"end": { "type": "integer", "minimum": 0 },
"line": { "type": "integer", "minimum": 1 },
"column": { "type": "integer", "minimum": 1 },
"endLine": { "type": "integer", "minimum": 1 },
"endColumn": { "type": "integer", "minimum": 1 },
"byteStart": { "type": "integer", "minimum": 0 },
"byteEnd": { "type": "integer", "minimum": 0 }
}
},
"source": {
"type": "object",
"additionalProperties": false,
"required": ["fileName", "encoding", "bom", "sha256", "rawBase64"],
"properties": {
"fileName": { "type": ["string", "null"] },
"encoding": { "enum": ["utf-16le", "utf-16be", "utf-8", "unknown"] },
"bom": { "enum": ["utf-16le", "utf-16be", "utf-8", "none"] },
"sha256": { "type": ["string", "null"], "pattern": "^[0-9a-f]{64}$" },
"rawBase64": { "type": ["string", "null"] }
}
},
"rational": {
"type": "object",
"additionalProperties": false,
"required": ["numerator", "denominator"],
"properties": {
"numerator": { "type": "integer" },
"denominator": { "type": "integer", "not": { "const": 0 } }
}
},
"pitch": {
"type": ["object", "null"],
"additionalProperties": false,
"required": ["degree", "accidental", "octave"],
"properties": {
"degree": { "type": ["integer", "null"] },
"accidental": { "enum": [-1, 0, 1] },
"octave": { "type": ["integer", "null"] }
}
},
"binding": {
"type": ["object", "null"],
"additionalProperties": false,
"required": ["range", "raw"],
"properties": {
"range": { "$ref": "#/$defs/range" },
"raw": { "type": ["string", "null"] }
}
},
"decoration": {
"type": "object",
"additionalProperties": false,
"required": ["id", "kind", "raw", "playback", "sourceRange"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"kind": { "type": "string" },
"raw": { "type": "string" },
"playback": { "enum": ["w1", "visual", "unknown"] },
"sourceRange": { "$ref": "#/$defs/range" }
}
},
"tuplet": {
"type": "object",
"additionalProperties": false,
"required": ["id", "ratio", "ordinal", "raw"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"ratio": { "type": "integer", "minimum": 2 },
"ordinal": { "type": "integer", "minimum": 0 },
"raw": { "type": "string" }
}
},
"privateGlyph": {
"type": "object",
"additionalProperties": false,
"required": ["fontRole", "codePoint", "raw"],
"properties": {
"fontRole": { "type": ["string", "null"] },
"codePoint": { "type": ["integer", "null"] },
"raw": { "type": "string" }
}
},
"event": {
"type": "object",
"additionalProperties": false,
"required": ["id", "kind", "pitch", "duration", "text", "source"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"kind": { "enum": ["note", "rest", "barline", "text", "unknown"] },
"pitch": { "$ref": "#/$defs/pitch" },
"duration": { "anyOf": [{ "$ref": "#/$defs/rational" }, { "type": "null" }] },
"text": { "type": ["string", "null"] },
"source": { "$ref": "#/$defs/binding" },
"decorations": { "type": "array", "items": { "$ref": "#/$defs/decoration" } },
"chord": { "type": "array", "items": { "$ref": "#/$defs/pitch" } },
"hidden": { "type": "boolean" },
"lyricSkip": { "type": "boolean" },
"tuplet": { "anyOf": [{ "$ref": "#/$defs/tuplet" }, { "type": "null" }] },
"privateGlyph": { "anyOf": [{ "$ref": "#/$defs/privateGlyph" }, { "type": "null" }] },
"velocity": { "type": "number", "minimum": 0, "maximum": 127 },
"gateRatio": { "anyOf": [{ "$ref": "#/$defs/rational" }, { "type": "null" }] }
}
},
"measure": {
"type": "object",
"additionalProperties": false,
"required": ["id", "ordinal", "beats", "events"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"ordinal": { "type": "integer", "minimum": 0 },
"beats": { "$ref": "#/$defs/rational" },
"events": { "type": "array", "items": { "$ref": "#/$defs/event" } },
"barlineBefore": { "enum": ["|", "||", "|:", ":|", "::", "dashed", "unknown"] },
"barlineAfter": { "enum": ["|", "||", "|:", ":|", "::", "dashed", "unknown"] },
"repeatStart": { "type": "boolean" },
"repeatEnd": { "type": "boolean" },
"ending": { "type": ["integer", "null"], "minimum": 1 },
"tempoBpm": { "type": ["number", "null"], "minimum": 1 },
"meter": { "anyOf": [{ "type": "object", "additionalProperties": false, "required": ["numerator", "denominator"], "properties": { "numerator": { "type": "integer", "minimum": 1 }, "denominator": { "type": "integer", "minimum": 1 } } }, { "type": "null" }] },
"key": { "type": ["string", "null"] }
}
},
"voice": {
"type": "object",
"additionalProperties": false,
"required": ["id", "name", "sectionId", "visible", "measures"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"name": { "type": "string" },
"sectionId": { "type": ["string", "null"] },
"visible": { "type": "boolean" },
"measures": { "type": "array", "items": { "$ref": "#/$defs/measure" } },
"temporary": { "type": "boolean" },
"alignment": { "enum": ["aligned", "independent", "overlay"] },
"fontRole": { "type": ["string", "null"] }
}
},
"section": {
"type": "object",
"additionalProperties": false,
"required": ["id", "name", "known", "sourceRange"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"name": { "type": "string" },
"known": { "type": "boolean" },
"sourceRange": { "$ref": "#/$defs/range" }
}
},
"anchor": {
"type": "object",
"additionalProperties": false,
"required": ["raw", "startId", "endId"],
"properties": {
"raw": { "type": ["string", "null"] },
"startId": { "type": ["string", "null"] },
"endId": { "type": ["string", "null"] }
}
},
"lyric": {
"type": "object",
"additionalProperties": false,
"required": ["verseStart", "verseEnd", "prefix", "lines", "syllables"],
"properties": {
"verseStart": { "type": ["integer", "null"] },
"verseEnd": { "type": ["integer", "null"] },
"prefix": { "type": ["string", "null"] },
"lines": { "type": "array", "items": { "type": "string" } },
"syllables": { "type": "array", "items": { "type": "string" } },
"syllableEventIds": { "type": "array", "items": { "type": ["string", "null"] } }
}
},
"attachment": {
"type": "object",
"additionalProperties": false,
"required": ["id", "kind", "raw", "anchor", "status", "sourceRange"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"kind": { "type": "string" },
"raw": { "type": "string" },
"anchor": { "$ref": "#/$defs/anchor" },
"status": { "enum": ["attached", "orphaned", "unresolved"] },
"sourceRange": { "$ref": "#/$defs/range" },
"lyric": { "$ref": "#/$defs/lyric" },
"visible": { "type": "boolean" },
"privateGlyph": { "anyOf": [{ "$ref": "#/$defs/privateGlyph" }, { "type": "null" }] }
}
},
"pageObject": {
"type": "object",
"additionalProperties": false,
"required": ["id", "kind", "raw", "sourceRange"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"kind": { "type": "string" },
"raw": { "type": "string" },
"sourceRange": { "$ref": "#/$defs/range" },
"position": { "anyOf": [{ "type": "object", "additionalProperties": false, "required": ["x", "y"], "properties": { "x": { "type": "number" }, "y": { "type": "number" } } }, { "type": "null" }] },
"visible": { "type": "boolean" }
}
},
"unknownBlock": {
"type": "object",
"additionalProperties": false,
"required": ["id", "reason", "rawText", "context", "sourceRange"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"reason": { "type": "string" },
"rawText": { "type": "string" },
"context": { "type": "string" },
"sourceRange": { "$ref": "#/$defs/range" }
}
},
"title": {
"type": "object",
"additionalProperties": false,
"required": ["title", "composer", "lyricist", "key", "meter", "tempo", "expression"],
"properties": {
"title": { "type": "string" },
"composer": { "type": "string" },
"lyricist": { "type": "string" },
"key": { "type": "string" },
"meter": { "type": "string" },
"tempo": { "type": ["number", "null"] },
"expression": { "type": "string" }
}
},
"manualLayout": {
"type": "object",
"additionalProperties": false,
"required": ["lockedMeasureIds", "forcedBreakAfterMeasureIds", "measureSpacing", "objectPositions"],
"properties": {
"lockedMeasureIds": { "type": "array", "items": { "type": "string" } },
"forcedBreakAfterMeasureIds": { "type": "array", "items": { "type": "string" } },
"measureSpacing": { "type": "object", "additionalProperties": { "type": "number" } },
"objectPositions": { "type": "object", "additionalProperties": { "type": "object", "required": ["x", "y"], "properties": { "x": { "type": "number" }, "y": { "type": "number" } } } },
"measurePositions": { "type": "object", "additionalProperties": { "type": "object", "required": ["x", "y"], "properties": { "x": { "type": "number" }, "y": { "type": "number" } } } },
"voiceOrder": { "type": "array", "items": { "type": "string" } },
"voiceSpacing": { "type": "object", "additionalProperties": { "type": "number" } },
"voiceAlignment": { "type": "object", "additionalProperties": { "enum": ["aligned", "independent", "overlay"] } },
"lyricOffsets": { "type": "object", "additionalProperties": { "type": "object", "required": ["x", "y"], "properties": { "x": { "type": "number" }, "y": { "type": "number" } } } },
"fontOverrides": { "type": "object", "additionalProperties": { "type": "object", "properties": { "role": { "type": "string" }, "sizePx": { "type": "number" }, "scaleX": { "type": "number" }, "scaleY": { "type": "number" } } } }
}
},
"score": {
"type": "object",
"additionalProperties": false,
"required": ["title", "sections", "voices", "attachments", "pageObjects", "unknownBlocks", "documentOptions", "fontRoles", "manualLayout", "playbackPolicyVersion"],
"properties": {
"title": { "$ref": "#/$defs/title" },
"sections": { "type": "array", "items": { "$ref": "#/$defs/section" } },
"voices": { "type": "array", "items": { "$ref": "#/$defs/voice" } },
"attachments": { "type": "array", "items": { "$ref": "#/$defs/attachment" } },
"pageObjects": { "type": "array", "items": { "$ref": "#/$defs/pageObject" } },
"unknownBlocks": { "type": "array", "items": { "$ref": "#/$defs/unknownBlock" } },
"documentOptions": { "type": "object", "additionalProperties": { "type": "string" } },
"fontRoles": { "type": "object", "additionalProperties": { "type": "string" } },
"manualLayout": { "$ref": "#/$defs/manualLayout" },
"playbackPolicyVersion": { "const": 1 }
}
}
}
}