1{
2  "$schema": "http://json-schema.org/draft-07/schema#",
3  "$id": "https://github.com/espressif/esp-idf/blob/master/tools/tools-schema.json",
4  "type": "object",
5  "properties": {
6    "version": {
7      "type": "integer",
8      "description": "Metadata file version"
9    },
10    "tools": {
11      "type": "array",
12      "description": "List of tools",
13      "items": {
14        "$ref": "#/definitions/toolInfo"
15      }
16    }
17  },
18  "required": [
19    "version",
20    "tools"
21  ],
22  "definitions": {
23    "toolInfo": {
24      "type": "object",
25      "description": "Information about one tool",
26      "properties": {
27        "name" : {
28          "description": "Tool name (used as a directory name)",
29          "type": "string"
30        },
31        "description" : {
32          "description": "A short (one sentence) description of the tool.",
33          "type": "string"
34        },
35        "export_paths": {
36          "$ref": "#/definitions/exportPaths"
37        },
38        "export_vars": {
39          "$ref": "#/definitions/envVars",
40          "description": "Some variable expansions are done on the values. 1) ${TOOL_PATH} is replaced with the directory where the tool is installed."
41        },
42        "info_url": {
43          "description": "URL of the page with information about the tool",
44          "type": "string"
45        },
46        "install": {
47          "$ref": "#/definitions/installRequirementInfo",
48          "description": "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation."
49        },
50        "license": {
51          "description": "License name. Use SPDX license identifier if it exists, short name of the license otherwise.",
52          "type": "string"
53        },
54        "version_cmd": {
55          "$ref": "#/definitions/arrayOfStrings",
56          "description": "Command to be executed (along with any extra arguments). The executable be present in one of the export_paths."
57        },
58        "supported_targets": {
59          "$ref": "#/definitions/arrayOfStrings",
60          "description": "Array of esp_targets that this tool is needed for."
61        },
62        "version_regex": {
63          "description": "Regex which is to be applied to version_cmd output to extract the version. By default, the version will be the first capture group of the expression. If version_regex_replace is specified, version will be obtained by doing a substitution using version_regex_replace instead.",
64          "$ref": "#/definitions/regex"
65        },
66        "version_regex_replace": {
67          "description": "If given, this will be used as substitute expression for the regex defined in version_regex, to obtain the version string. Not specifying this is equivalent to setting it to '\\1' (i.e. return the first capture group).",
68          "type": "string"
69        },
70        "strip_container_dirs": {
71          "type": "integer",
72          "description": "If specified, this number of top directory levels will removed when extracting. E.g. if strip_container_dirs=2, archive path a/b/c/d.txt will be extracted as c/d.txt"
73        },
74        "versions": {
75          "type": "array",
76          "description": "List of versions",
77          "items": {
78            "$ref": "#/definitions/versionInfo"
79          }
80        },
81        "platform_overrides": {
82          "type": "array",
83          "description": "List of platform-specific overrides",
84          "items": {
85            "$ref": "#/definitions/platformOverrideInfo"
86          }
87        }
88      },
89      "required": [
90        "description",
91        "export_paths",
92        "version_cmd",
93        "version_regex",
94        "versions",
95        "install",
96        "info_url",
97        "license"
98      ]
99    },
100    "arrayOfStrings": {
101      "description": "Array of strings. Used to represent paths (split into components) and command lines (split into arguments)",
102      "type": "array",
103      "items": {
104        "type": "string"
105      }
106    },
107    "exportPaths": {
108      "description": "Array of paths to be exported (added to PATH). Each item in the array is relative to the directory where the tool will be installed.",
109      "type": "array",
110      "items": {
111        "$ref": "#/definitions/arrayOfStrings"
112      }
113    },
114    "envVars": {
115      "description": "Collection of environment variables. Keys and values are the environment variable names and values, respectively.",
116      "type": "object",
117      "patternProperties": {
118        "^([A-Z_0-9]+)+$": {
119          "type": "string"
120        }
121      },
122      "additionalProperties": false
123    },
124    "regex": {
125      "description": "A regular expression",
126      "type": "string"
127    },
128    "versionInfo": {
129      "type": "object",
130      "properties": {
131        "name" : {
132          "description": "Version name (used as a directory name)",
133          "type": "string"
134        },
135        "status": {
136            "description": "Determines whether the version is recommended/supported/deprecated",
137            "type": "string",
138            "enum": ["recommended", "supported", "deprecated"]
139        },
140        "linux-i686": {
141          "$ref": "#/definitions/platformDownloadInfo"
142        },
143        "linux-amd64": {
144          "$ref": "#/definitions/platformDownloadInfo"
145        },
146        "linux-armel": {
147          "$ref": "#/definitions/platformDownloadInfo"
148        },
149        "linux-arm64": {
150          "$ref": "#/definitions/platformDownloadInfo"
151        },
152        "macos": {
153          "$ref": "#/definitions/platformDownloadInfo"
154        },
155        "win32": {
156          "$ref": "#/definitions/platformDownloadInfo"
157        },
158        "win64": {
159          "$ref": "#/definitions/platformDownloadInfo"
160        },
161        "any": {
162          "$ref": "#/definitions/platformDownloadInfo"
163        }
164      }
165    },
166    "platformDownloadInfo": {
167      "description": "Information about download artifact for one platform",
168      "type": "object",
169      "properties": {
170        "sha256": {
171          "type": "string",
172          "description": "SHA256 sum of the file"
173        },
174        "size": {
175          "type": "integer",
176          "description": "Size of the file, in bytes"
177        },
178        "url": {
179          "type": "string",
180          "description": "Download URL"
181        }
182      },
183      "required": [
184        "sha256",
185        "url",
186        "size"
187      ]
188    },
189    "installRequirementInfo": {
190      "description": "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation.",
191      "type": "string",
192      "enum": ["always", "on_request", "never"]
193    },
194    "platformOverrideInfo": {
195      "description": "Platform-specific values which override the defaults",
196      "type": "object",
197      "properties": {
198        "platforms": {
199          "description": "List of platforms to which this override applies",
200          "type": "array",
201          "items": {
202            "type": "string",
203            "enum": ["linux-i686", "linux-amd64", "linux-armel", "linux-arm64", "macos", "win32", "win64"]
204          }
205        },
206        "export_paths": {
207          "description": "Platform-specific replacement for toolInfo/export_paths",
208          "$ref": "#/definitions/exportPaths"
209        },
210        "export_vars": {
211          "description": "Platform-specific replacement for toolInfo/export_vars",
212          "$ref": "#/definitions/envVars"
213        },
214        "install": {
215          "description": "Platform-specific replacement for toolInfo/install",
216          "$ref": "#/definitions/installRequirementInfo"
217        },
218        "version_cmd": {
219          "description": "Platform-specific replacement for toolInfo/version_cmd",
220          "$ref": "#/definitions/arrayOfStrings"
221        },
222        "supported_targets": {
223          "description": "Platform-specific replacement for toolInfo/supported_targets",
224          "$ref": "#/definitions/arrayOfStrings"
225        },
226        "version_regex": {
227          "description": "Platform-specific replacement for toolInfo/version_regex",
228          "$ref": "#/definitions/regex"
229        },
230        "version_regex_replace": {
231          "description": "Platform-specific replacement for toolInfo/version_regex_replace",
232          "type": "string"
233        },
234        "strip_container_dirs": {
235          "type": "string",
236          "description": "Platform-specific replacement for toolInfo/strip_container_dirs"
237        }
238      },
239      "required": ["platforms"]
240    }
241  }
242}
243