From ff5dace0247bbd70d6579868d16357a4c93947e2 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Tue, 19 Nov 2024 14:07:08 +0100 Subject: [PATCH] chore: update schema --- shop/config.go | 31 ++++++++++++++++++++++++++++++- shop/shopware-project-schema.json | 28 +++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/shop/config.go b/shop/config.go index add982e..1e6a746 100644 --- a/shop/config.go +++ b/shop/config.go @@ -106,7 +106,9 @@ type ConfigDeployment struct { // When enabled, the extensions will be installed, updated, and removed Enabled bool `yaml:"enabled"` // Which extensions should not be managed - Exclude []string + Exclude []string `yaml:"exclude"` + + Overrides ConfigDeploymentOverrides `yaml:"overrides"` } `yaml:"extension-management"` OneTimeTasks []struct { @@ -115,6 +117,33 @@ type ConfigDeployment struct { } `yaml:"one-time-tasks"` } +type ConfigDeploymentOverrides map[string]struct { + State string `yaml:"state"` +} + +func (c ConfigDeploymentOverrides) JSONSchema() *jsonschema.Schema { + properties := orderedmap.New[string, *jsonschema.Schema]() + + properties.Set("state", &jsonschema.Schema{ + Type: "string", + Enum: []interface{}{"inactive", "remove", "ignore"}, + }) + + properties.Set("keepUserData", &jsonschema.Schema{ + Type: "boolean", + }) + + return &jsonschema.Schema{ + Type: "object", + Title: "Extension overrides", + AdditionalProperties: &jsonschema.Schema{ + Type: "object", + Properties: properties, + Required: []string{"state"}, + }, + } +} + type ConfigSyncConfig struct { // Sales Channel ID to apply SalesChannel *string `yaml:"sales_channel,omitempty"` diff --git a/shop/shopware-project-schema.json b/shop/shopware-project-schema.json index ec2f00c..5e3e612 100644 --- a/shop/shopware-project-schema.json +++ b/shop/shopware-project-schema.json @@ -149,11 +149,14 @@ "enabled": { "type": "boolean" }, - "Exclude": { + "exclude": { "items": { "type": "string" }, "type": "array" + }, + "overrides": { + "$ref": "#/$defs/ConfigDeploymentOverrides" } }, "additionalProperties": false, @@ -183,6 +186,29 @@ "additionalProperties": false, "type": "object" }, + "ConfigDeploymentOverrides": { + "additionalProperties": { + "properties": { + "state": { + "type": "string", + "enum": [ + "inactive", + "remove", + "ignore" + ] + }, + "keepUserData": { + "type": "boolean" + } + }, + "type": "object", + "required": [ + "state" + ] + }, + "type": "object", + "title": "Extension overrides" + }, "ConfigDump": { "properties": { "rewrite": {