Skip to content

Commit

Permalink
chore: update schema
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Nov 19, 2024
1 parent 05235ec commit ff5dace
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
31 changes: 30 additions & 1 deletion shop/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"`
Expand Down
28 changes: 27 additions & 1 deletion shop/shopware-project-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,14 @@
"enabled": {
"type": "boolean"
},
"Exclude": {
"exclude": {
"items": {
"type": "string"
},
"type": "array"
},
"overrides": {
"$ref": "#/$defs/ConfigDeploymentOverrides"
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit ff5dace

Please sign in to comment.