Skip to content

Instantly share code, notes, and snippets.

@pofulu
Last active November 22, 2022 07:51
Show Gist options
  • Save pofulu/e31818a7266fb5e7eb231a7796a1816f to your computer and use it in GitHub Desktop.
Save pofulu/e31818a7266fb5e7eb231a7796a1816f to your computer and use it in GitHub Desktop.
Google Web Designer Custom Component Manifest JSON Schema

Usage

.
├── .vscode/
│   └── settings.json
├── manifest.json
└── manifest.schema.json

.vscode/settings.json

{
  "json.schemas": [
    {
      "fileMatch": [
        "/manifest.json"
      ],
      "url": "/manifest.schema.json"
    }
  ]
}
{
"$schema": "https://json-schema.org/draft/2020-12/output/schema",
"valid": true,
"additionalProperties": false,
"definitions": {
"ExtensionsConfig": {
"additionalProperties": false,
"type": "object"
}
},
"type": "object",
"required": [
"version",
"type",
"customElementsVersion"
],
"properties": {
"name": {
"type": "string",
"description": "The human-readable name of the component."
},
"description": {
"type": "string",
"description": "A succinct but complete description of the component."
},
"type": {
"type": "string",
"description": "The element type, which must contain a hyphen (-). Required."
},
"tagName": {
"type": "string"
},
"version": {
"type": "number",
"description": "The component version number, which must be incremented with each update. Required."
},
"customElementsVersion": {
"type": "number",
"description": "The Custom Element specification version number, which should be set to 1 for newly authored components. Required for new components."
},
"nestable": {
"type": "boolean",
"description": "When true, other element could be place in this element."
},
"files": {
"type": "object",
"additionalProperties": false,
"description": "The JavaScript and CSS files for the component.",
"properties": {
"js": {
"description": "The path to JavaScript files, relative to the manifest.json file.",
"type": "array",
"items": {
"type": "string"
}
},
"css": {
"description": "The path to the CSS files, relative to the manifest.json file.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"externalScripts": {
"type": "array",
"description": "The external scripts for the component.",
"items": {
"type": "string"
}
},
"externalStyles": {
"type": "array",
"description": "The external style sheets for the component.",
"items": {
"type": "string"
}
},
"dependencies": {
"type": "array",
"description": "Other components that this component depends on.",
"items": {
"type": "string"
}
},
"attributes": {
"type": "array",
"description": "The attributes of the component.",
"items": {
"additionalProperties": false,
"type": "object",
"properties": {
"name": {
"description": "The name of the attribute.",
"type": "string"
},
"label": {
"description": "The human-readable name of the attribute.",
"type": "string"
},
"type": {
"description": "The data type of the attribute.",
"enum": [
"string",
"number",
"file",
"color",
"boolean",
"dropdown"
]
},
"description": {
"description": "A short description of the attribute.",
"type": "string"
},
"required": {
"description": "Whether the attribute is required.",
"type": "boolean"
},
"defaultValue": {
"description": "The default value of the attribute.",
"type": [
"boolean",
"string"
]
},
"min": {
"description": "Minimum value for the attribute, if the attribute is a number.",
"type": "number"
},
"max": {
"description": "Maximum value for the attribute, if the attribute is a number.",
"type": "number"
},
"accept": {
"description": "File types accepted, if the attribute is a file.",
"type": "string"
},
"gwdSpecific": {
"additionalProperties": false,
"type": "object",
"properties": {
"type": {
"const": "dropdown"
},
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"important": {
"type": "boolean",
"description": "When true, includes the attribute in the component tag."
},
"label": {
"type": "string",
"description": "The key in the strings file for translation."
},
"advanced": {
"type": "boolean",
"description": "Whether this attribute is shown in the Advanced properties section of the Properties panel."
},
"v1Name": {
"type": "string",
"description": "The name of this attribute in v.1 of Google Web Designer."
}
},
"dependentRequired": {
"type": [
"items"
]
}
},
"bindable": {
"type": "boolean",
"description": "When true, the attribute is exposed on the Bindings tab of the Dynamic Properties dialog."
}
}
}
},
"methods": {
"type": "array",
"description": "The methods of the component.",
"items": {
"additionalProperties": false,
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the method."
},
"label": {
"type": "string",
"description": "The human-readable name of the method."
},
"description": {
"type": "string",
"description": "A short description of the method."
},
"parameters": {
"type": "array",
"description": "The parameters of this method.",
"items": {
"additionalProperties": false,
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the parameter."
},
"label": {
"type": "string",
"description": "The human-readable name of the parameter."
},
"type": {
"type": "string",
"description": "The data type of the parameter."
},
"optional": {
"type": "boolean",
"description": "Whether the parameter is optional."
}
}
}
}
}
}
},
"events": {
"type": "array",
"description": "The events sent by the component.",
"items": {
"additionalProperties": false,
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the event."
},
"label": {
"type": "string",
"description": "The human-readable name of the event."
},
"description": {
"type": "string",
"description": "A couple of sentences describing the event."
},
"parameters": {
"items": {
"type": "string"
},
"type": "array",
"description": " The parameters of the event; by default, the Event object."
}
}
}
},
"metrics": {
"type": "array",
"description": "The metrics tracked for the component.",
"items": {
"additionalProperties": false,
"type": "object",
"properties": {
"eventName": {
"type": "string",
"description": "The event that's tracked for this metric."
},
"metric": {
"type": "string",
"description": "The text used when reporting the tracked event."
},
"isCumulative": {
"type": "boolean",
"description": "Whether the metric is cumulative."
},
"exit": {
"type": "string",
"description": "The exit associated with the metric event."
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment