Skip to content

Commit e93a2f0

Browse files
authored
Added json schema for 0.8 version (#1617)
## Summary Title says it. I put the file in `.schema/` directory so that in future if we change the schema we can align it with version. Meaning, we can add new schema files with version numbers and enforce the schema based on the version of devbox a user has installed. Putting it in root of this repository would make the root too crowded especially if we add more schema files. I'm going to host our schema in this repository and subsequently send a PR to https://github.com/SchemaStore/schemastore/ with a link to the schema file in our repo to register our repo in https://schemastore.org afterwards, I can update the vscode extension to reference the schemastore.org link and enforce our defined schema on files that are named `devbox.json` ## How was it tested? validated schema and examples of devbox.json in https://www.jsonschemavalidator.net/
1 parent f01fa59 commit e93a2f0

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.schema/devbox.schema.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"$id": "https://github.com/jetpack-io/devbox",
4+
"title": "Devbox json definition",
5+
"description": "Defines fields and acceptable values of devbox.json",
6+
"type": "object",
7+
"properties": {
8+
"packages": {
9+
"description": "Collection of packages to install",
10+
"oneOf": [
11+
{
12+
"type": "array",
13+
"items": {
14+
"description": "Name and version of each package in name@version format.",
15+
"type": "string"
16+
}
17+
},
18+
{
19+
"type": "object",
20+
"description": "Name of each package in {\"name\": \"version\"} format.",
21+
"patternProperties": {
22+
".*": {
23+
"type": "string",
24+
"description": "Version of the package to install."
25+
}
26+
}
27+
},
28+
{
29+
"type": "object",
30+
"description": "Name of each package in {\"name\": {\"version\": \"1.2.3\"}} format.",
31+
"patternProperties": {
32+
".*": {
33+
"type": "object",
34+
"description": "Version number of the specified package in {\"version\": \"1.2.3\"} format.",
35+
"properties": {
36+
"version": {
37+
"type": "string",
38+
"description": "Version of the package"
39+
},
40+
"platform": {},
41+
"excluded_platform": {},
42+
"glibc_patch": {}
43+
}
44+
}
45+
}
46+
}
47+
]
48+
},
49+
"env": {
50+
"description": "List of additional environment variables to be set in the Devbox environment. Values containing $PATH or $PWD will be expanded. No other variable expansion or command substitution will occur.",
51+
"type": "object"
52+
},
53+
"shell": {
54+
"description": "Definitions of scripts and actions to take when in devbox shell.",
55+
"type": "object",
56+
"properties": {
57+
"init_hook": {
58+
"type": [
59+
"array",
60+
"string"
61+
],
62+
"items": {
63+
"description": "List of shell commands/scripts to run right after devbox shell starts.",
64+
"type": "string"
65+
}
66+
},
67+
"scripts": {
68+
"description": "List of command/script definitions to run with `devbox run <script_name>`.",
69+
"type": "object",
70+
"patternProperties": {
71+
".*": {
72+
"description": "Alias name for the script.",
73+
"type": [
74+
"array",
75+
"string"
76+
],
77+
"items": {
78+
"type": "string",
79+
"description": "The script's shell commands."
80+
}
81+
}
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}

0 commit comments

Comments
 (0)