Skip to content

Commit

Permalink
Add JSON schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Jun 1, 2024
1 parent a03628a commit 03211d5
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"json.schemas": [
{
"fileMatch": [
"changelog.json"
],
"url": "./types/changelog.schema.json"
},
{
"fileMatch": [
"plugins.json"
],
"url": "./types/plugins.schema.json"
}
]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ These are the files that can be added to the plugin directory
* `plugins/plugin_id/icon.png` or `icon.svg`: The plugin icon. Icons can be either PNG files with a resolution of 48x48, or they can be SVG files. To register an icon, set the icon field in the plugin meta data to the file name of the icon.
* `plugins/plugin_id/members.yml`: This file allows you to list Github users who have your permission to do changes to your model, without me having to check back with you. You can add two types of members: `maintainers` Can do anything with the plugin, including removing it entirely or modifying the members list. `developers` can contribute new versions of the plugin.
* `plugins/plugin_id/LICENSE.MD`: Add a license if you want to license your plugin as open source. You can choose your license here: [choosealicense.com](https://choosealicense.com)
* `plugins/plugin_id/changelog.json`: Add a changelog file for your plugin. Set `has_changelog` to `true` in the meta data to enable this. If you use VS Code (which I recommend), you'll automatically have autocomplete and validation for this file. Make sure to add new versions to the bottom of the file!
* `plugins/plugin_id/src/**`: Use this directory to store the plugin source, if using a bundler.

## Development
Expand Down
70 changes: 70 additions & 0 deletions types/changelog.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "changelog.schema",
"title": "Changelog",
"description": "A plugin changelog. Make sure to add new versions at the bottom of the document!",
"type": "object",
"propertyNames": {
"pattern": "^\\d+.\\d+.\\d+$"
},
"additionalProperties": {
"type": "object",
"required": ["title", "author", "date", "categories"],
"properties": {
"title": {"type": "string"},
"date": {"type": "string", "description": "Date as YYYY/MM/DD", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"},
"author": {"type": "string"},
"categories": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {"type": "string"},
"list": {
"type": "array",
"items": {"type": "string"}
}
},
"defaultSnippets": [
{
"label": "Category",
"description": "A new category or changes",
"body": {
"title": "Changes",
"list": [
""
]
}
}
]
}
}
},
"defaultSnippets": [
{
"label": "New Version",
"description": "A new version example snippet",
"body": {
"title": "1.0.0",
"author": "",
"date": "2017-05-07",
"categories": [
{
"title": "Features",
"list": [
""
]
},
{
"title": "Fixes",
"list": [
""
]
}
]

}
}
]
}
}
98 changes: 98 additions & 0 deletions types/plugins.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "plugins.schema",
"title": "plugins.json",
"description": "List of all plugins and their store metadata",
"type": "object",
"additionalProperties": {
"type": "object",
"required": ["title", "author", "version", "icon"],
"properties": {
"title": {
"type": "string",
"description": "Name of the plugin"
},
"author": {
"type": "string",
"description": "Author or authors"
},
"icon": {
"type": "string",
"description": "Icon, either an icon resolvable string, or icon.png / icon.svg in the new repo format"
},
"description": {
"type": "string",
"description": "Short plugin description"
},
"tags": {
"type": "array",
"items": {"type": "string"},
"description": "Tags to help categorize the plugin",
"maxItems": 3
},
"version": {
"type": "string",
"description": "Semver version string"
},
"min_version": {
"type": "string",
"description": "Minimum required Blockbench version to run this plugin"
},
"variant": {
"type": "string",
"enum": ["both", "desktop", "web"],
"description": "Specify if Blockbench can run only on desktop, only in the web app, or on both"
},
"creation_date": {
"type": "string",
"description": "Date of when the plugin was first released. As YYYY/MM/DD",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"new_repository_format": {
"type": "boolean",
"deprecated": true,
"description": "Instruct the plugin to use the new repository format, see README.md. This field was only used in the transition period, instead the behavior is now based on a min_version of 4.8.0 or higher."
},
"has_changelog": {
"type": "boolean",
"description": "Whether the plugin has a changelog.json file, specifying changes in past updates."
},
"await_loading": {
"type": "boolean",
"description": "Set to true if you need the plugin to finish loading when starting Blockbench before loading files"
},
"contributes": {
"type": "object",
"properties": {
"formats": {
"type": "array",
"items": {"type": "string"}
}
}
},
"website": {
"type": "string",
"description": "Link to the plugins website",
"pattern": "^https://.+"
}
},
"defaultSnippets": [
{
"label": "Basic plugin",
"description": "A new plugin example",
"body": {
"title": "My Plugin",
"author": "Benchbot",
"description": "",
"icon": "icon.png",
"version": "1.0.0",
"min_version": "4.10.0",
"variant": "both"
}
}
]
},
"propertyNames": {
"pattern": "^[a-z0-9_]{3,64}$"
}
}

0 comments on commit 03211d5

Please sign in to comment.