| 1 | { |
| 2 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 3 | "id": "https://opencc.byvoid.com/schema/opencc_config.schema.json", |
| 4 | "title": "OpenCC configuration", |
| 5 | "type": "object", |
| 6 | "required": ["name", "conversion_chain"], |
| 7 | "additionalProperties": false, |
| 8 | "properties": { |
| 9 | "name": { "type": "string" }, |
| 10 | "normalization": { |
| 11 | "type": "array", |
| 12 | "minItems": 1, |
| 13 | "items": { "$ref": "#/definitions/conversion" } |
| 14 | }, |
| 15 | "segmentation": { "$ref": "#/definitions/segmentation" }, |
| 16 | "conversion_chain": { |
| 17 | "type": "array", |
| 18 | "minItems": 1, |
| 19 | "items": { "$ref": "#/definitions/conversion" } |
| 20 | } |
| 21 | }, |
| 22 | "definitions": { |
| 23 | "segmentation": { |
| 24 | "anyOf": [ |
| 25 | { "$ref": "#/definitions/mmseg_segmentation" }, |
| 26 | { "$ref": "#/definitions/plugin_segmentation" } |
| 27 | ] |
| 28 | }, |
| 29 | "mmseg_segmentation": { |
| 30 | "type": "object", |
| 31 | "required": ["type", "dict"], |
| 32 | "additionalProperties": false, |
| 33 | "properties": { |
| 34 | "type": { "enum": ["mmseg"] }, |
| 35 | "dict": { "$ref": "#/definitions/dict" } |
| 36 | } |
| 37 | }, |
| 38 | "plugin_segmentation": { |
| 39 | "type": "object", |
| 40 | "required": ["type"], |
| 41 | "not": { |
| 42 | "properties": { "type": { "enum": ["mmseg"] } }, |
| 43 | "required": ["type"] |
| 44 | }, |
| 45 | "properties": { |
| 46 | "type": { "type": "string", "minLength": 1 }, |
| 47 | "resources": { |
| 48 | "type": "object", |
| 49 | "additionalProperties": { "type": "string" } |
| 50 | } |
| 51 | }, |
| 52 | "additionalProperties": { "type": "string" } |
| 53 | }, |
| 54 | "conversion": { |
| 55 | "type": "object", |
| 56 | "required": ["dict"], |
| 57 | "additionalProperties": false, |
| 58 | "properties": { "dict": { "$ref": "#/definitions/dict" } } |
| 59 | }, |
| 60 | "dict": { |
| 61 | "anyOf": [ |
| 62 | { "$ref": "#/definitions/file_dict" }, |
| 63 | { "$ref": "#/definitions/inline_dict" }, |
| 64 | { "$ref": "#/definitions/group_dict" } |
| 65 | ] |
| 66 | }, |
| 67 | "file_dict": { |
| 68 | "type": "object", |
| 69 | "required": ["type", "file"], |
| 70 | "additionalProperties": false, |
| 71 | "properties": { |
| 72 | "type": { "enum": ["text", "ocd", "ocd2"] }, |
| 73 | "file": { "type": "string", "minLength": 1 }, |
| 74 | "may_output_tofu": { "type": "boolean" } |
| 75 | } |
| 76 | }, |
| 77 | "inline_dict": { |
| 78 | "type": "object", |
| 79 | "required": ["type", "entries"], |
| 80 | "additionalProperties": false, |
| 81 | "properties": { |
| 82 | "type": { "enum": ["inline"] }, |
| 83 | "entries": { |
| 84 | "type": "object", |
| 85 | "additionalProperties": { "type": "string", "minLength": 1 } |
| 86 | } |
| 87 | } |
| 88 | }, |
| 89 | "group_dict": { |
| 90 | "type": "object", |
| 91 | "required": ["type", "dicts", "match_policy"], |
| 92 | "additionalProperties": false, |
| 93 | "properties": { |
| 94 | "type": { "enum": ["group"] }, |
| 95 | "match_policy": { "enum": ["short_circuit", "union"] }, |
| 96 | "dicts": { |
| 97 | "type": "array", |
| 98 | "minItems": 1, |
| 99 | "items": { "$ref": "#/definitions/dict" } |
| 100 | }, |
| 101 | "may_output_tofu": { "type": "boolean" } |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | } |