{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "HTML Widget Template Schema",
    "description": "Defines a web-component based widget template that uses vanilla HTML.",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "meta",
        "htmlTemplate"
    ],
    "properties": {
        "meta": {
            "type": "object",
            "title": "Template Meta",
            "additionalProperties": false,
            "required": [
                "dependencies",
                "plugins"
            ],
            "properties": {
                "dependencies": {
                    "type": "array",
                    "description": "A list of NPM resources to load into the widget",
                    "items": {
                        "$ref": "#/definitions/npmDependency"
                    }
                },
                "plugins": {
                    "type": "array",
                    "description": "A list of component editors used in editing the widget",
                    "items": {
                        "$ref": "#/definitions/npmDependency"
                    }
                }
            }
        },
        "htmlTemplate": {
            "type": "string",
            "title": "HTML Template",
            "description": "Raw HTML content that can use web components."
        }
    },
    "definitions": {
        "npmDependency": {
            "type": "object",
            "properties": {
                "package": {
                    "type": "string",
                    "description": "An NPM package name or scoped package"
                },
                "version": {
                    "type": "string",
                    "description": "An NPM version string, such as Patch releases: 1.0 or 1.0.x or ~1.0.4 Minor releases: 1 or 1.x or ^1.0.4 Major releases: * or x",
                    "default": "latest"
                },
                "filePath": {
                    "type": "string",
                    "description": "The path to a resource in the specified package",
                    "default": ""
                }
            },
            "required": [
                "version",
                "package"
            ]
        }
    }
}