diff --git a/src/api/json/catalog.json b/src/api/json/catalog.json index 5abb7a07dd5..e9330028f15 100644 --- a/src/api/json/catalog.json +++ b/src/api/json/catalog.json @@ -2210,6 +2210,12 @@ "fileMatch": ["dockerd.json", "docker.json"], "url": "https://www.schemastore.org/dockerd.json" }, + { + "name": "Docker Desktop extension metadata", + "description": "Docker Desktop extension metadata configuration file. Documentation: https://docs.docker.com/extensions/extensions-sdk/architecture/metadata/", + "fileMatch": ["metadata.json"], + "url": "https://www.schemastore.org/docker-extension-metadata.json" + }, { "name": "docker bake", "description": "Docker Bake configuration file. Documentation: https://docs.docker.com/build/bake/reference", diff --git a/src/schemas/json/docker-extension-metadata.json b/src/schemas/json/docker-extension-metadata.json new file mode 100644 index 00000000000..f75b82f1e07 --- /dev/null +++ b/src/schemas/json/docker-extension-metadata.json @@ -0,0 +1,113 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "$id": "https://json.schemastore.org/docker-extension-metadata.json", + "title": "Metadata configuration schema for Docker Desktop extensions", + "definitions": { + "binariesOnVMHost": { + "type": "array", + "title": "Configuration schema for binaries that will be copied by Docker Desktop from the image onto the host machine.", + "items": { + "type": "object", + "properties": { + "path": { + "type": "string", + "title": "String path to the binary on the image.", + "description": "The path to the binary in the extension's image." + } + } + } + } + }, + "type": "object", + "description": "Docker Desktop extension.", + "properties": { + "icon": { + "type": "string", + "description": "The icon for the extension. Will be displayed on the sidebar, in the extension list and on Docker Hub." + }, + "ui": { + "type": "object", + "description": "UI configuration for your extension.", + "properties": { + "dashboard-tab": { + "type": "object", + "description": "Dashboard tab UI configuration.", + "properties": { + "title": { + "type": "string", + "description": "The name of your extension, that will be displayed in the dashboard." + }, + "root": { + "type": "string", + "description": "The root folder (in your extension's image) where your UI code is stored." + }, + "src": { + "type": "string", + "description": "The HTML entrypoint for the extension tab." + } + }, + "required": ["title", "src"] + } + } + }, + "vm": { + "type": "object", + "description": "Backend configuration for your extension.", + "properties": { + "image": { + "type": "string", + "description": "The image to use for your extension. A default compose file will be generated for your extension. If you want to use the same image that packages your extension, use ${DESKTOP_PLUGIN_IMAGE}." + }, + "composefile": { + "type": "string", + "description": "A path to your Docker compose file for your backend container." + } + } + }, + "host": { + "type": "object", + "description": "Host configuration for your extension.", + "properties": { + "binaries": { + "type": "array", + "description": "An array of binaries that Docker Desktop will copy from the extension image onto the host machine. These binaries can be invoked by your extension using the JavaScript API in your frontend. Docker Desktop automatically handles transfer of binaries for you. For more information, see https://docs.docker.com/extensions/extensions-sdk/guides/invoke-host-binaries/", + "items": { + "type": "object", + "properties": { + "darwin": { + "allOf": [ + { + "$ref": "#/definitions/binariesOnVMHost" + }, + { + "description": "Binaries that will be copied over on host machines running MacOS." + } + ] + }, + "windows": { + "allOf": [ + { + "$ref": "#/definitions/binariesOnVMHost" + }, + { + "description": "Binaries that will be copied over on host machines running Windows." + } + ] + }, + "linux": { + "allOf": [ + { + "$ref": "#/definitions/binariesOnVMHost" + }, + { + "description": "Binaries that will be copied over on host machines running Linux." + } + ] + } + } + } + } + } + } + } +} diff --git a/src/test/docker-extension-metadata/docker-extension-metadata.json b/src/test/docker-extension-metadata/docker-extension-metadata.json new file mode 100644 index 00000000000..0b6b81df8fd --- /dev/null +++ b/src/test/docker-extension-metadata/docker-extension-metadata.json @@ -0,0 +1,36 @@ +{ + "$schema": "../../schemas/json/docker-extension-metadata.json", + "host": { + "binaries": [ + { + "darwin": [ + { + "path": "/darwin/binary" + } + ], + "linux": [ + { + "path": "/linux/binary" + } + ], + "windows": [ + { + "path": "/windows/binary.exe" + } + ] + } + ] + }, + "icon": "extension-icon.svg", + "ui": { + "dashboard-tab": { + "root": "/ui", + "src": "index.html", + "title": "MyTitle" + } + }, + "vm": { + "composefile": "docker-compose.yml", + "image": "${DESKTOP_PLUGIN_IMAGE}" + } +}