• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2018 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3
4{
5    "$id": "http://unicode.org/icu-filter-schema",
6    "$schema": "http://json-schema.org/draft-04/schema#",
7    "description": "JSON Schema for an ICU data filter file",
8    "type": "object",
9    "properties": {
10        "strategy": {
11            "type": "string",
12            "enum": ["additive", "subtractive"]
13        },
14        "localeFilter": { "$ref": "#/definitions/filter" },
15        "featureFilters": {
16            "type": "object",
17            "additionalProperties": {
18                "oneOf": [
19                    { "$ref": "#/definitions/filter" },
20                    {
21                        "type": "string",
22                        "enum": ["include", "exclude"]
23                    }
24                ]
25            }
26        },
27        "resourceFilters": {
28            "type": "array",
29            "items": {
30                "type": "object",
31                "properties": {
32                    "categories": {
33                        "type": "array",
34                        "items": { "type": "string" }
35                    },
36                    "files": { "$ref": "#/definitions/filter" },
37                    "rules": {
38                        "type": "array",
39                        "items": {
40                            "type": "string",
41                            "pattern": "^[+-]/[\\S]*$"
42                        }
43                    }
44                },
45                "required": ["categories", "rules"],
46                "additionalProperties": false
47            }
48        },
49        "fileReplacements": {
50            "type": "object",
51            "properties": {
52                "directory": {
53                    "type": "string",
54                    "pattern": "^(\\$SRC|\\$FILTERS|\\$CWD|/$|/[^/]+)(/[^/]+)*$"
55                },
56                "replacements": {
57                    "type": "array",
58                    "items": {
59                        "oneOf": [
60                            { "type": "string" },
61                            {
62                                "type": "object",
63                                "properties": {
64                                    "src": { "type": "string" },
65                                    "dest": { "type": "string" }
66                                },
67                                "additionalProperties": false,
68                                "required": ["src", "dest"]
69                            }
70                        ]
71                    }
72                }
73            },
74            "additionalProperties": false,
75            "required": ["directory", "replacements"]
76        },
77        "collationUCAData": {
78            "type": "string",
79            "enum": ["unihan", "implicithan"]
80        },
81        "usePoolBundle": {
82            "type": "boolean"
83        }
84    },
85    "additionalProperties": false,
86    "definitions": {
87        "filter": {
88            "type": "object",
89            "oneOf": [
90                {
91                    "properties": {
92                        "filterType": {
93                            "$ref": "#/definitions/includeExcludeFilterTypes"
94                        },
95                        "whitelist": { "$ref": "#/definitions/stringList" }
96                    },
97                    "required": ["whitelist"],
98                    "additionalProperties": false
99                },
100                {
101                    "properties": {
102                        "filterType": {
103                            "$ref": "#/definitions/includeExcludeFilterTypes"
104                        },
105                        "blacklist": { "$ref": "#/definitions/stringList" }
106                    },
107                    "required": ["blacklist"],
108                    "additionalProperties": false
109                },
110                {
111                    "properties": {
112                        "filterType": {
113                            "$ref": "#/definitions/includeExcludeFilterTypes"
114                        },
115                        "includelist": { "$ref": "#/definitions/stringList" }
116                    },
117                    "required": ["includelist"],
118                    "additionalProperties": false
119                },
120                {
121                    "properties": {
122                        "filterType": {
123                            "$ref": "#/definitions/includeExcludeFilterTypes"
124                        },
125                        "excludelist": { "$ref": "#/definitions/stringList" }
126                    },
127                    "required": ["excludelist"],
128                    "additionalProperties": false
129                },
130                {
131                    "properties": {
132                        "filterType": {
133                            "type": "string",
134                            "enum": ["exclude"]
135                        }
136                    },
137                    "required": ["filterType"],
138                    "additionalProperties": false
139                },
140                {
141                    "properties": {
142                        "filterType": {
143                            "type": "string",
144                            "enum": ["locale"]
145                        },
146                        "includeChildren": {
147                            "type": "boolean"
148                        },
149                        "includeScripts": {
150                            "type": "boolean"
151                        },
152                        "whitelist": { "$ref": "#/definitions/stringList" }
153                    },
154                    "required": ["filterType", "whitelist"],
155                    "additionalProperties": false
156                },
157                {
158                    "properties": {
159                        "filterType": {
160                            "type": "string",
161                            "enum": ["locale"]
162                        },
163                        "includeChildren": {
164                            "type": "boolean"
165                        },
166                        "includeScripts": {
167                            "type": "boolean"
168                        },
169                        "includelist": { "$ref": "#/definitions/stringList" }
170                    },
171                    "required": ["filterType", "includelist"],
172                    "additionalProperties": false
173                },
174                {
175                    "properties": {
176                        "filterType": {
177                            "type": "string",
178                            "enum": ["union"]
179                        },
180                        "unionOf": {
181                            "type": "array",
182                            "items": { "$ref": "#/definitions/filter" }
183                        }
184                    },
185                    "required": ["filterType", "unionOf"],
186                    "additionalProperties": false
187                }
188            ]
189        },
190        "includeExcludeFilterTypes": {
191            "type": "string",
192            "enum": [
193                "language",
194                "regex"
195            ]
196        },
197        "stringList": {
198            "type": "array",
199            "items": {
200                "type": "string"
201            },
202            "minItems": 1,
203            "uniqueItems": true
204        }
205    }
206}
207