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        "version_regex": {
59          "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.",
60          "$ref": "#/definitions/regex"
61        },
62        "version_regex_replace": {
63          "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).",
64          "type": "string"
65        },
66        "strip_container_dirs": {
67          "type": "integer",
68          "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"
69        },
70        "versions": {
71          "type": "array",
72          "description": "List of versions",
73          "items": {
74            "$ref": "#/definitions/versionInfo"
75          }
76        },
77        "platform_overrides": {
78          "type": "array",
79          "description": "List of platform-specific overrides",
80          "items": {
81            "$ref": "#/definitions/platformOverrideInfo"
82          }
83        }
84      },
85      "required": [
86        "description",
87        "export_paths",
88        "version_cmd",
89        "version_regex",
90        "versions",
91        "install",
92        "info_url",
93        "license"
94      ]
95    },
96    "arrayOfStrings": {
97      "description": "Array of strings. Used to represent paths (split into components) and command lines (split into arguments)",
98      "type": "array",
99      "items": {
100        "type": "string"
101      }
102    },
103    "exportPaths": {
104      "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.",
105      "type": "array",
106      "items": {
107        "$ref": "#/definitions/arrayOfStrings"
108      }
109    },
110    "envVars": {
111      "description": "Collection of environment variables. Keys and values are the environment variable names and values, respectively.",
112      "type": "object",
113      "patternProperties": {
114        "^([A-Z_0-9]+)+$": {
115          "type": "string"
116        }
117      },
118      "additionalProperties": false
119    },
120    "regex": {
121      "description": "A regular expression",
122      "type": "string"
123    },
124    "versionInfo": {
125      "type": "object",
126      "properties": {
127        "name" : {
128          "description": "Version name (used as a directory name)",
129          "type": "string"
130        },
131        "status": {
132            "description": "Determines whether the version is recommended/supported/deprecated",
133            "type": "string",
134            "enum": ["recommended", "supported", "deprecated"]
135        },
136        "linux-i686": {
137          "$ref": "#/definitions/platformDownloadInfo"
138        },
139        "linux-amd64": {
140          "$ref": "#/definitions/platformDownloadInfo"
141        },
142        "linux-armel": {
143          "$ref": "#/definitions/platformDownloadInfo"
144        },
145        "linux-arm64": {
146          "$ref": "#/definitions/platformDownloadInfo"
147        },
148        "macos": {
149          "$ref": "#/definitions/platformDownloadInfo"
150        },
151        "win32": {
152          "$ref": "#/definitions/platformDownloadInfo"
153        },
154        "win64": {
155          "$ref": "#/definitions/platformDownloadInfo"
156        },
157        "any": {
158          "$ref": "#/definitions/platformDownloadInfo"
159        }
160      }
161    },
162    "platformDownloadInfo": {
163      "description": "Information about download artifact for one platform",
164      "type": "object",
165      "properties": {
166        "sha256": {
167          "type": "string",
168          "description": "SHA256 sum of the file"
169        },
170        "size": {
171          "type": "integer",
172          "description": "Size of the file, in bytes"
173        },
174        "url": {
175          "type": "string",
176          "description": "Download URL"
177        }
178      },
179      "required": [
180        "sha256",
181        "url",
182        "size"
183      ]
184    },
185    "installRequirementInfo": {
186      "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.",
187      "type": "string",
188      "enum": ["always", "on_request", "never"]
189    },
190    "platformOverrideInfo": {
191      "description": "Platform-specific values which override the defaults",
192      "type": "object",
193      "properties": {
194        "platforms": {
195          "description": "List of platforms to which this override applies",
196          "type": "array",
197          "items": {
198            "type": "string",
199            "enum": ["linux-i686", "linux-amd64", "linux-armel", "linux-arm64", "macos", "win32", "win64"]
200          }
201        },
202        "export_paths": {
203          "description": "Platform-specific replacement for toolInfo/export_paths",
204          "$ref": "#/definitions/exportPaths"
205        },
206        "export_vars": {
207          "description": "Platform-specific replacement for toolInfo/export_vars",
208          "$ref": "#/definitions/envVars"
209        },
210        "install": {
211          "description": "Platform-specific replacement for toolInfo/install",
212          "$ref": "#/definitions/installRequirementInfo"
213        },
214        "version_cmd": {
215          "description": "Platform-specific replacement for toolInfo/version_cmd",
216          "$ref": "#/definitions/arrayOfStrings"
217        },
218        "version_regex": {
219          "description": "Platform-specific replacement for toolInfo/version_regex",
220          "$ref": "#/definitions/regex"
221        },
222        "version_regex_replace": {
223          "description": "Platform-specific replacement for toolInfo/version_regex_replace",
224          "type": "string"
225        },
226        "strip_container_dirs": {
227          "type": "string",
228          "description": "Platform-specific replacement for toolInfo/strip_container_dirs"
229        }
230      },
231      "required": ["platforms"]
232    }
233  }
234}
235