diff --git a/extension/snippet_validator.go b/extension/snippet_validator.go index c6804351..6c1434f8 100644 --- a/extension/snippet_validator.go +++ b/extension/snippet_validator.go @@ -215,17 +215,17 @@ func compareSnippets(mainFile []byte, file string, context *ValidationContext, e normalizedPath := strings.ReplaceAll(file, extensionRoot+"/", "") if diff.Type == jsondiff.OperationReplace && reflect.TypeOf(diff.OldValue) != reflect.TypeOf(diff.Value) { - context.AddError(fmt.Sprintf("Snippet file: %s, key: %s, has the type %s, but in the main language it is %s", normalizedPath, diff.Path, reflect.TypeOf(diff.OldValue), reflect.TypeOf(diff.Value))) + context.AddWarning(fmt.Sprintf("Snippet file: %s, key: %s, has the type %s, but in the main language it is %s", normalizedPath, diff.Path, reflect.TypeOf(diff.OldValue), reflect.TypeOf(diff.Value))) continue } if diff.Type == jsondiff.OperationAdd { - context.AddError(fmt.Sprintf("Snippet file: %s, missing key \"%s\" in this snippet file, but defined in the main language", normalizedPath, diff.Path)) + context.AddWarning(fmt.Sprintf("Snippet file: %s, missing key \"%s\" in this snippet file, but defined in the main language", normalizedPath, diff.Path)) continue } if diff.Type == jsondiff.OperationRemove { - context.AddError(fmt.Sprintf("Snippet file: %s, key %s is missing, but defined in the main language file", normalizedPath, diff.Path)) + context.AddWarning(fmt.Sprintf("Snippet file: %s, key %s is missing, but defined in the main language file", normalizedPath, diff.Path)) continue } } diff --git a/extension/snippet_validator_test.go b/extension/snippet_validator_test.go index c9e836f9..570ce85a 100644 --- a/extension/snippet_validator_test.go +++ b/extension/snippet_validator_test.go @@ -72,8 +72,8 @@ func TestSnippetValidateStorefrontByPathTestDifferent(t *testing.T) { _ = os.WriteFile(path.Join(tmpDir, "Resources", "snippet", "storefront.de-DE.json"), []byte(`{"b": "2"}`), os.ModePerm) assert.NoError(t, validateStorefrontSnippetsByPath(tmpDir, tmpDir, context)) - assert.Len(t, context.errors, 2) - assert.Len(t, context.warnings, 0) - assert.Contains(t, context.errors[0], "key /a is missing, but defined in the main language file") - assert.Contains(t, context.errors[1], "missing key \"/b\" in this snippet file, but defined in the main language") + assert.Len(t, context.errors, 0) + assert.Len(t, context.warnings, 2) + assert.Contains(t, context.warnings[0], "key /a is missing, but defined in the main language file") + assert.Contains(t, context.warnings[1], "missing key \"/b\" in this snippet file, but defined in the main language") }