From 6db7601bc33533ea2e0a689025254c350aa3663c Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Tue, 1 Oct 2024 14:40:39 +0200 Subject: [PATCH] feat: generate shopware project config schema automatically --- go.mod | 5 + go.sum | 11 + schema.go | 38 ++ shop/config.go | 160 ++++++-- shop/shopware-project-schema.json | 654 +++++++++++++++++------------- 5 files changed, 556 insertions(+), 312 deletions(-) create mode 100644 schema.go diff --git a/go.mod b/go.mod index 3c33e66..6a1fda9 100644 --- a/go.mod +++ b/go.mod @@ -30,12 +30,17 @@ require ( ) require ( + github.com/bahlo/generic-list-go v0.2.0 // indirect + github.com/buger/jsonparser v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/invopop/jsonschema v0.12.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/tidwall/gjson v1.17.1 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect + github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect golang.org/x/sync v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index 1e617da..31709c0 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,12 @@ github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cq github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/bep/godartsass/v2 v2.1.0 h1:fq5Y1xYf4diu4tXABiekZUCA+5l/dmNjGKCeQwdy+s0= github.com/bep/godartsass/v2 v2.1.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= +github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/caarlos0/env/v9 v9.0.0 h1:SI6JNsOA+y5gj9njpgybykATIylrRMklbs5ch6wO6pc= github.com/caarlos0/env/v9 v9.0.0/go.mod h1:ye5mlCVMYh6tZ+vCgrs/B95sj88cg5Tlnc0XIzgZ020= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -56,16 +60,21 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI= +github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= github.com/jaswdr/faker v1.19.1 h1:xBoz8/O6r0QAR8eEvKJZMdofxiRH+F0M/7MU9eNKhsM= github.com/jaswdr/faker v1.19.1/go.mod h1:x7ZlyB1AZqwqKZgyQlnqEG8FDptmHlncA5u2zY/yi6w= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -113,6 +122,8 @@ github.com/vulcand/oxy/v2 v2.0.0 h1:V+scHhd2xBjO8ojBRgxCM+OdZxRA/YTs8M70w5tdNy8= github.com/vulcand/oxy/v2 v2.0.0/go.mod h1:uIAz3sYafO7i+V3SC8oDlMn/lt1i9aWcyXuXqVswKzE= github.com/wI2L/jsondiff v0.6.0 h1:zrsH3FbfVa3JO9llxrcDy/XLkYPLgoMX6Mz3T2PP2AI= github.com/wI2L/jsondiff v0.6.0/go.mod h1:D6aQ5gKgPF9g17j+E9N7aasmU1O+XvfmWm1y8UMmNpw= +github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= +github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= diff --git a/schema.go b/schema.go new file mode 100644 index 0000000..b87c808 --- /dev/null +++ b/schema.go @@ -0,0 +1,38 @@ +package main + +import ( + "encoding/json" + "github.com/FriendsOfShopware/shopware-cli/shop" + "github.com/invopop/jsonschema" + "os" +) + +func generateProjectSchema() error { + r := new(jsonschema.Reflector) + r.FieldNameTag = "yaml" + r.RequiredFromJSONSchemaTags = true + + if err := r.AddGoComments("github.com/FriendsOfShopware/shopware-cli", "./shop"); err != nil { + return err + } + + schema := r.Reflect(&shop.Config{}) + + bytes, err := json.MarshalIndent(schema, "", " ") + + if err != nil { + return err + } + + if err := os.WriteFile("shop/shopware-project-schema.json", bytes, 0644); err != nil { + return err + } + + return nil +} + +func main() { + if err := generateProjectSchema(); err != nil { + panic(err) + } +} diff --git a/shop/config.go b/shop/config.go index 87ff547..fa7c7ba 100644 --- a/shop/config.go +++ b/shop/config.go @@ -2,6 +2,8 @@ package shop import ( "fmt" + "github.com/invopop/jsonschema" + orderedmap "github.com/wk8/go-ordered-map/v2" "os" "strings" @@ -14,38 +16,56 @@ import ( ) type Config struct { - AdditionalConfigs []string `yaml:"include,omitempty"` - URL string `yaml:"url"` - Build *ConfigBuild `yaml:"build,omitempty"` - AdminApi *ConfigAdminApi `yaml:"admin_api,omitempty"` - ConfigDump *ConfigDump `yaml:"dump,omitempty"` - Sync *ConfigSync `yaml:"sync,omitempty"` - foundConfig bool + AdditionalConfigs []string `yaml:"include,omitempty"` + // The URL of the Shopware instance + URL string `yaml:"url"` + Build *ConfigBuild `yaml:"build,omitempty"` + AdminApi *ConfigAdminApi `yaml:"admin_api,omitempty"` + ConfigDump *ConfigDump `yaml:"dump,omitempty"` + Sync *ConfigSync `yaml:"sync,omitempty"` + ConfigDeployment *ConfigDeployment `yaml:"deployment,omitempty"` + foundConfig bool } type ConfigBuild struct { - DisableAssetCopy bool `yaml:"disable_asset_copy,omitempty"` - RemoveExtensionAssets bool `yaml:"remove_extension_assets,omitempty"` - KeepExtensionSource bool `yaml:"keep_extension_source,omitempty"` - KeepSourceMaps bool `yaml:"keep_source_maps,omitempty"` - CleanupPaths []string `yaml:"cleanup_paths,omitempty"` - Browserslist string `yaml:"browserslist,omitempty"` - ExcludeExtensions []string `yaml:"exclude_extensions,omitempty"` + // When enabled, the assets will not be copied to the public folder + DisableAssetCopy bool `yaml:"disable_asset_copy,omitempty"` + // When enabled, the assets of extensions will be removed from the extension public folder. (Requires Shopware 6.5.2.0) + RemoveExtensionAssets bool `yaml:"remove_extension_assets,omitempty"` + // When enabled, the extensions source code will be keep in the final build + KeepExtensionSource bool `yaml:"keep_extension_source,omitempty"` + // When enabled, the source maps will not be removed from the final build + KeepSourceMaps bool `yaml:"keep_source_maps,omitempty"` + // Paths to delete for the final build + CleanupPaths []string `yaml:"cleanup_paths,omitempty"` + // Browserslist configuration for the Storefront build + Browserslist string `yaml:"browserslist,omitempty"` + // Extensions to exclude from the build + ExcludeExtensions []string `yaml:"exclude_extensions,omitempty"` } type ConfigAdminApi struct { - ClientId string `yaml:"client_id,omitempty"` - ClientSecret string `yaml:"client_secret,omitempty"` - Username string `yaml:"username,omitempty"` - Password string `yaml:"password,omitempty"` - DisableSSLCheck bool `yaml:"disable_ssl_check,omitempty"` + // Client ID of integration + ClientId string `yaml:"client_id,omitempty"` + // Client Secret of integration + ClientSecret string `yaml:"client_secret,omitempty"` + // Username of admin user + Username string `yaml:"username,omitempty"` + // Password of admin user + Password string `yaml:"password,omitempty"` + // Disable SSL certificate check + DisableSSLCheck bool `yaml:"disable_ssl_check,omitempty"` } type ConfigDump struct { + // Allows to rewrite single columns, perfect for GDPR compliance Rewrite map[string]core.Rewrite `yaml:"rewrite,omitempty"` - NoData []string `yaml:"nodata,omitempty"` - Ignore []string `yaml:"ignore,omitempty"` - Where map[string]string `yaml:"where,omitempty"` + // Only export the schema of these tables + NoData []string `yaml:"nodata,omitempty"` + // Ignore these tables from export + Ignore []string `yaml:"ignore,omitempty"` + // Add an where condition to that table, schema is table name as key, and where statement as value + Where map[string]string `yaml:"where,omitempty"` } type ConfigSync struct { @@ -55,9 +75,41 @@ type ConfigSync struct { Entity []EntitySync `yaml:"entity"` } +type ConfigDeployment struct { + Hooks struct { + // The pre hook will be executed before the deployment + Pre string `yaml:"pre"` + // The post hook will be executed after the deployment + Post string `yaml:"post"` + // The pre-install hook will be executed before the installation + PreInstall string `yaml:"pre-install"` + // The post-install hook will be executed after the installation + PostInstall string `yaml:"post-install"` + // The pre-update hook will be executed before the update + PreUpdate string `yaml:"pre-update"` + // The post-update hook will be executed after the update + PostUpdate string `yaml:"post-update"` + } `yaml:"hooks"` + + // The extension management of the deployment + ExtensionManagement struct { + // When enabled, the extensions will be installed, updated, and removed + Enabled bool `yaml:"enabled"` + // Which extensions should not be managed + Exclude []string + } `yaml:"extension-management"` + + OneTimeTasks []struct { + Id string `yaml:"id" jsonschema:"required"` + Script string `yaml:"script" jsonschema:"required"` + } `yaml:"one-time-tasks"` +} + type ConfigSyncConfig struct { - SalesChannel *string `yaml:"sales_channel,omitempty"` - Settings map[string]interface{} `yaml:"settings"` + // Sales Channel ID to apply + SalesChannel *string `yaml:"sales_channel,omitempty"` + // Configurations of that Sales Channel + Settings map[string]interface{} `yaml:"settings"` } type ThemeConfig struct { @@ -72,10 +124,68 @@ type MailTemplate struct { type EntitySync struct { Entity string `yaml:"entity"` - Exists *[]interface{} `yaml:"exists"` + Exists *[]EntitySyncFilter `yaml:"exists,omitempty"` Payload map[string]interface{} `yaml:"payload"` } +type EntitySyncFilter struct { + // The type of filter + Type string `yaml:"type" jsonschema:"required,enum=equals,enum=multi,enum=contains,enum=prefix,enum=suffix,enum=not,enum=range,enum=until,enum=equalsAll,enum=equalsAny"` + // The field to filter on + Field string `yaml:"field" jsonschema:"required"` + // The actual filter value + Value interface{} `yaml:"value"` + // The operator to use for multiple filters + Operator *string `yaml:"operator,omitempty" jsonschema:"enum=AND,enum=OR,enum=XOR"` + // The filters to apply, when type set to multi + Queries *[]EntitySyncFilter `yaml:"queries,omitempty"` +} + +func (s EntitySyncFilter) JSONSchema() *jsonschema.Schema { + properties := orderedmap.New[string, *jsonschema.Schema]() + + properties.Set("type", &jsonschema.Schema{ + Type: "string", + Enum: []interface{}{"equals", "multi", "contains", "prefix", "suffix", "not", "range", "until", "equalsAll", "equalsAny"}, + }) + + properties.Set("field", &jsonschema.Schema{ + Type: "string", + Description: "The field to filter on", + }) + + properties.Set("value", &jsonschema.Schema{ + Description: "The actual filter value", + }) + + properties.Set("operator", &jsonschema.Schema{ + Type: "string", + Enum: []interface{}{"AND", "OR", "XOR"}, + }) + + ifProperties := orderedmap.New[string, *jsonschema.Schema]() + ifProperties.Set("type", &jsonschema.Schema{ + Const: "multi", + }) + + return &jsonschema.Schema{ + Type: "object", + Title: "Entity Sync Filter", + Properties: properties, + Required: []string{"type", "field"}, + AllOf: []*jsonschema.Schema{ + { + If: &jsonschema.Schema{ + Properties: ifProperties, + Then: &jsonschema.Schema{ + Required: []string{"type", "queries"}, + }, + }, + }, + }, + } +} + type MailTemplateTranslation struct { Language string `yaml:"language"` SenderName string `yaml:"sender_name"` diff --git a/shop/shopware-project-schema.json b/shop/shopware-project-schema.json index d5006d4..4e0cafe 100644 --- a/shop/shopware-project-schema.json +++ b/shop/shopware-project-schema.json @@ -1,307 +1,387 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "shopware-cli", - "description": "shopware cli project configuration definition file", - "$ref": "#/definitions/Config", - "definitions": { - "Config": { - "type": "object", - "title": ".shopware-project.yml", - "additionalProperties": false, - "properties": { - "url": { - "type": "string", - "description": "URL to Shopware instance" - }, - "admin_api": { - "$ref": "#/definitions/AdminApi" - }, - "dump": { - "$ref": "#/definitions/Dump" - }, - "sync": { - "$ref": "#/definitions/Sync" - }, - "build": { - "$ref": "#/definitions/Build" - } - } + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/FriendsOfShopware/shopware-cli/shop/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "include": { + "items": { + "type": "string" + }, + "type": "array" }, - "Build": { - "type": "object", - "title": "Project Build Settings", - "additionalProperties": false, - "properties": { - "disable_asset_copy": { - "type": "boolean", - "description": "When enabled, the assets will not be copied to the public folder", - "default": false - }, - "keep_source_maps": { - "type": "boolean", - "description": "When enabled, the source maps will not be removed from the final build", - "default": false - }, - "remove_extension_assets": { - "type": "boolean", - "description": "When enabled, the assets of extensions will be removed from the extension public folder. (Requires Shopware 6.5.2.0)", - "default": false - }, - "cleanup_paths": { - "type": "array", - "items": {"type": "string"}, - "description": "Paths to delete for the final build" - }, - "browserslist": { - "type": "string", - "description": "Browserslist configuration for the Storefront build" - }, - "exclude_extensions": { - "type": "array", - "items": {"type": "string"}, - "description": "Extensions to exclude from the build" - } - } + "url": { + "type": "string", + "description": "The URL of the Shopware instance" }, - "AdminApi": { - "type": "object", - "title": "Admin API credentials", - "additionalProperties": false, - "properties": { - "client_id": { - "type": "string", - "description": "Client ID of integration" - }, - "client_secret": { - "type": "string", - "description": "Client Secret of integration" - }, - "username": { - "type": "string", - "description": "Username of admin user" - }, - "password": { - "type": "string", - "description": "Password of admin user" - }, - "disable_ssl_check": { - "type": "boolean", - "description": "Disable SSL check for API requests", - "default": false - } - } + "build": { + "$ref": "#/$defs/ConfigBuild" }, - "Dump": { - "type": "object", - "title": "MySQL dump configuration", - "additionalProperties": false, - "properties": { - "rewrite": { - "type": "object" - }, - "nodata": { - "type": "array", - "items": {"type": "string"} - }, - "ignore": { - "type": "array", - "items": {"type": "string"} - }, - "where": { - "type": "object" - } - } + "admin_api": { + "$ref": "#/$defs/ConfigAdminApi" }, - "Sync": { - "type": "object", - "title": "Sync Settings", - "additionalProperties": false, - "properties": { - "config": { - "type": "array", - "items": {"$ref": "#/definitions/SyncConfigItem"} - }, - "theme": { - "type": "array", - "items": {"$ref": "#/definitions/ThemeConfigItem"} - }, - "mail_template": { - "type": "array", - "items": {"$ref": "#/definitions/MailTemplateItem"} - }, - "entity": { - "type": "array", - "items": {"$ref": "#/definitions/EntitySyncItem"} - } - } + "dump": { + "$ref": "#/$defs/ConfigDump" }, - "SyncConfigItem": { - "type": "object", - "title": "System Config Sync", - "additionalProperties": false, - "properties": { - "sales_channel": { - "title": "Sales Channel to apply", - "type": "string" - }, - "settings": { - "type": "object" - } - }, - "required": ["settings"] + "sync": { + "$ref": "#/$defs/ConfigSync" }, - "ThemeConfigItem": { - "type": "object", - "title": "Theme Config Sync", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "settings": { - "type": "object" - } - } + "deployment": { + "$ref": "#/$defs/ConfigDeployment" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ConfigAdminApi": { + "properties": { + "client_id": { + "type": "string", + "description": "Client ID of integration" }, - "MailTemplateItem": { - "type": "object", - "title": "Mail Template Sync", - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "translations": { - "type": "array", - "items": {"$ref": "#/definitions/MailTemplateItemTranslation"} - } - } + "client_secret": { + "type": "string", + "description": "Client Secret of integration" }, - "MailTemplateItemTranslation": { - "type": "object", - "title": "Mail Template Single Translation", - "additionalProperties": false, - "properties": { - "language": { - "type": "string" - }, - "sender_name": { - "type": "string" - }, - "subject": { - "type": "string" - }, - "html": { - "type": "string" - }, - "plain": { - "type": "string" - }, - "custom_fields": { - "type": ["object", "null"] - } + "username": { + "type": "string", + "description": "Username of admin user" + }, + "password": { + "type": "string", + "description": "Password of admin user" + }, + "disable_ssl_check": { + "type": "boolean", + "description": "Disable SSL certificate check" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ConfigBuild": { + "properties": { + "disable_asset_copy": { + "type": "boolean", + "description": "When enabled, the assets will not be copied to the public folder" + }, + "remove_extension_assets": { + "type": "boolean", + "description": "When enabled, the assets of extensions will be removed from the extension public folder. (Requires Shopware 6.5.2.0)" + }, + "keep_extension_source": { + "type": "boolean", + "description": "When enabled, the extensions source code will be keep in the final build" + }, + "keep_source_maps": { + "type": "boolean", + "description": "When enabled, the source maps will not be removed from the final build" + }, + "cleanup_paths": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Paths to delete for the final build" + }, + "browserslist": { + "type": "string", + "description": "Browserslist configuration for the Storefront build" + }, + "exclude_extensions": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Extensions to exclude from the build" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ConfigDeployment": { + "properties": { + "hooks": { + "properties": { + "pre": { + "type": "string" + }, + "post": { + "type": "string" + }, + "pre-install": { + "type": "string" + }, + "post-install": { + "type": "string" + }, + "pre-update": { + "type": "string" + }, + "post-update": { + "type": "string" } + }, + "additionalProperties": false, + "type": "object" }, - "EntitySyncItem": { - "type": "object", - "title": "Entity Sync", - "additionalProperties": false, - "properties": { - "entity": { - "type": "string" - }, - "exists": { - "type": "array", - "items": {"$ref": "#/definitions/EntitySyncFilter"} - }, - "payload": { - "type": "object", - "description": "API payload" - } + "extension-management": { + "properties": { + "enabled": { + "type": "boolean" }, - "required": ["entity", "payload"] + "Exclude": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "description": "The extension management of the deployment" }, - "EntitySyncFilter": { - "type": "object", - "title": "Entity Sync Filter", - "additionalProperties": false, + "one-time-tasks": { + "items": { "properties": { - "type": { - "type": "string", - "enum": ["equals", "multi", "contains", "prefix", "suffix", "not", "range", "until", "equalsAll" ,"equalsAny"], - "description": "filter type" - }, - "field": { - "type": "string", - "description": "field" - }, - "value": { - "type": ["string", "integer", "array", "boolean", "null"], - "description": "value" - }, - "operator": { - "type": "string", - "enum": ["AND", "OR", "XOR"] - }, - "queries": { - "type": "array", - "items": {"$ref": "#/definitions/EntitySyncFilterInner"} - } + "id": { + "type": "string" + }, + "script": { + "type": "string" + } }, - "required": ["type", "field"], - "allOf": [ - { - "if": { - "properties": { - "type": { - "const": "multi" - } - } - }, - "then": { - "required": ["type", "queries"] - } - } + "additionalProperties": false, + "type": "object", + "required": [ + "id", + "script" ] + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ConfigDump": { + "properties": { + "rewrite": { + "additionalProperties": { + "$ref": "#/$defs/Rewrite" + }, + "type": "object", + "description": "Allows to rewrite single columns, perfect for GDPR compliance" }, - "EntitySyncFilterInner": { - "type": "object", - "title": "Entity Sync Filter", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "enum": ["equals", "multi", "contains", "prefix", "suffix", "not", "range", "until", "equalsAll" ,"equalsAny"], - "description": "filter type" - }, - "field": { - "type": "string", - "description": "field" - }, - "value": { - "type": ["string", "integer", "array", "boolean", "null"], - "description": "value" - }, - "operator": { - "type": "string", - "enum": ["AND", "OR", "XOR"] - } + "nodata": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Only export the schema of these tables" + }, + "ignore": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Ignore these tables from export" + }, + "where": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Add an where condition to that table, schema is table name as key, and where statement as value" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ConfigSync": { + "properties": { + "config": { + "items": { + "$ref": "#/$defs/ConfigSyncConfig" + }, + "type": "array" + }, + "theme": { + "items": { + "$ref": "#/$defs/ThemeConfig" + }, + "type": "array" + }, + "mail_template": { + "items": { + "$ref": "#/$defs/MailTemplate" + }, + "type": "array" + }, + "entity": { + "items": { + "$ref": "#/$defs/EntitySync" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ConfigSyncConfig": { + "properties": { + "sales_channel": { + "type": "string", + "description": "Sales Channel ID to apply" + }, + "settings": { + "type": "object", + "description": "Configurations of that Sales Channel" + } + }, + "additionalProperties": false, + "type": "object" + }, + "EntitySync": { + "properties": { + "entity": { + "type": "string" + }, + "exists": { + "items": { + "$ref": "#/$defs/EntitySyncFilter" + }, + "type": "array" + }, + "payload": { + "type": "object" + } + }, + "additionalProperties": false, + "type": "object" + }, + "EntitySyncFilter": { + "allOf": [ + { + "if": { + "then": { + "required": [ + "type", + "queries" + ] }, - "required": ["type", "field"], - "allOf": [ - { - "if": { - "properties": { - "type": { - "const": "multi" - } - } - }, - "then": { - "required": ["type", "queries"] - } - } - ] + "properties": { + "type": { + "const": "multi" + } + } + } + } + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "equals", + "multi", + "contains", + "prefix", + "suffix", + "not", + "range", + "until", + "equalsAll", + "equalsAny" + ] + }, + "field": { + "type": "string", + "description": "The field to filter on" + }, + "value": { + "description": "The actual filter value" + }, + "operator": { + "type": "string", + "enum": [ + "AND", + "OR", + "XOR" + ] + } + }, + "type": "object", + "required": [ + "type", + "field" + ], + "title": "Entity Sync Filter" + }, + "MailTemplate": { + "properties": { + "id": { + "type": "string" + }, + "translations": { + "items": { + "$ref": "#/$defs/MailTemplateTranslation" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object" + }, + "MailTemplateTranslation": { + "properties": { + "language": { + "type": "string" + }, + "sender_name": { + "type": "string" + }, + "subject": { + "type": "string" + }, + "html": { + "type": "string" + }, + "plain": { + "type": "string" + }, + "custom_fields": true + }, + "additionalProperties": false, + "type": "object" + }, + "Rewrite": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "ThemeConfig": { + "properties": { + "name": { + "type": "string" + }, + "settings": { + "additionalProperties": { + "$ref": "#/$defs/ThemeConfigValue" + }, + "type": "object" } + }, + "additionalProperties": false, + "type": "object" + }, + "ThemeConfigValue": { + "properties": { + "value": true + }, + "additionalProperties": false, + "type": "object" } -} + } +} \ No newline at end of file