Skip to content

Commit 64e82bf

Browse files
authored
Create a json schema for plugins (#1659)
## Summary Adds a JSON schema for creating plugins. Hopefully, this should make authoring plugins a bit easier ## How was it tested? Tested against the `devbox plugins` repo --------- Signed-off-by: John Lago <[email protected]>
1 parent b5d5c1a commit 64e82bf

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.schema/devbox-plugin.schema.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-04/schema#",
3+
"$id": "https://github.com/jetpack-io/devbox/plugins",
4+
"title": "Devbox Plugin Schema",
5+
"description": "Defines fields and values for public devbox plugins",
6+
"type": "object",
7+
"properties": {
8+
"$schema": {
9+
"description": "The schema version of this plugin file.",
10+
"type": "string"
11+
},
12+
"name": {
13+
"description": "The name of the plugin.",
14+
"type": "string"
15+
},
16+
"version": {
17+
"description": "The version of the plugin.",
18+
"type": "string"
19+
},
20+
"readme": {
21+
"description": "A short description of the plugin and how it works. This will automatically display when the user first installs the plugin, or runs `devbox info`",
22+
"type": "string"
23+
},
24+
"env": {
25+
"type": "object",
26+
"description": "List of additional environment variables to be set in the Devbox environment. These can be overridden by environment variables set in the user's devbox.json",
27+
"patternProperties": {
28+
".*": {
29+
"type": "string",
30+
"description": "Value of the environment variable."
31+
}
32+
}
33+
},
34+
"create_files": {
35+
"type": "object",
36+
"description": "List of files to create in the user's project directory when the plugin is activated. The key points to the file path where the file will be created. The value points to the default file that should be copied to that location",
37+
"patternProperties": {
38+
".*": {
39+
"type": "string",
40+
"description": "Contents of the file."
41+
}
42+
}
43+
},
44+
"shell": {
45+
"type": "object",
46+
"description": "Shell specific options and hooks for the plugin.",
47+
"items": {
48+
"init_hook": {
49+
"type": ["array", "string"],
50+
"description": "Shell command to run right before initializing the user's shell, running a script, or starting a service"
51+
}
52+
}
53+
}
54+
},
55+
"required": ["name", "version", "readme"]
56+
}

0 commit comments

Comments
 (0)