Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2c3f76e
Add dynamic templates as parameter
mrodm Dec 12, 2024
41d7b88
Add validation for each dynamic template depending on the parameters
mrodm Dec 16, 2024
ff5298e
Fixes for dynamic templates
mrodm Dec 16, 2024
af04d66
Compare fields with dynamic templates
mrodm Dec 17, 2024
f21c712
Remove multi_fields from flattened fields
mrodm Dec 17, 2024
aa28db6
Test without filtering dynamic templates
mrodm Dec 17, 2024
3767111
Ensure properties subfields are validated accordingly
mrodm Dec 18, 2024
9fb80b4
Restore filtering and add tests
mrodm Dec 18, 2024
2ad28ac
Disable unmatch_mapping_type and match_mapping_type and continue look…
mrodm Dec 19, 2024
8bdad65
Merge upstream/main into validate-dynamic-mappings
mrodm Dec 19, 2024
151e59e
Refactors and remove log statements
mrodm Dec 19, 2024
d0ff6b9
Fix function naming
mrodm Dec 19, 2024
b474b4b
Add test with match_pattern regex
mrodm Dec 19, 2024
066b5a0
Add comment in tests
mrodm Dec 19, 2024
a7eb191
Remove loading schema from create validator for mappings method
mrodm Jan 7, 2025
7666ac2
Separate parsing and validation of dynamic templates
mrodm Jan 7, 2025
a718796
Support match_pattern for the other settings
mrodm Jan 7, 2025
0a5e775
fix test
mrodm Jan 8, 2025
131cc9c
Update tests for multi-fields
mrodm Jan 8, 2025
38db8df
Review multi-fields logic
mrodm Jan 8, 2025
9ff3d0c
Revisit multi-fields logic in ECS
mrodm Jan 8, 2025
5165612
Report all errors related to multi-fields comparing with ECS
mrodm Jan 8, 2025
ce557c9
Ignored validation of multi-fields with ECS
mrodm Jan 8, 2025
ebda859
Fix multi-field test
mrodm Jan 8, 2025
019ffd4
Rephrase errors
mrodm Jan 9, 2025
8f36c18
Validate fully dynamic objects (preview) with dynamic templates
mrodm Jan 9, 2025
d96ffbf
Rephrase debug message
mrodm Jan 9, 2025
dbca4fe
Add logging - to be removed
mrodm Jan 9, 2025
8fce0ec
Merge remote-tracking branch 'upstream/main' into validate-dynamic-ma…
mrodm Jan 14, 2025
c333707
Revisited log messages
mrodm Jan 20, 2025
0569cfb
Remove comments
mrodm Jan 20, 2025
1aea303
Remove more debug statements
mrodm Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revisited log messages
  • Loading branch information
mrodm committed Jan 20, 2025
commit c3337074d6f00aefa3956c49db08c19098034dc7
12 changes: 3 additions & 9 deletions internal/fields/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (v *MappingValidator) validateObjectProperties(path string, couldBeParamete
if childField, ok := value.(map[string]any); ok {
if isEmptyObject(childField) {
// TODO: Should this be raised as an error instead?
logger.Debugf("field %q skipped: empty object wihtout definition in the preview", currentPath)
logger.Debugf("field %q skipped: empty object without definition in the preview", currentPath)
continue
}
ecsErrors := v.validateMappingsNotInPreview(currentPath, childField, dynamicTemplates)
Expand Down Expand Up @@ -561,7 +561,7 @@ func (v *MappingValidator) validateMappingsNotInPreview(currentPath string, chil

for fieldPath, object := range flattenFields {
if slices.Contains(v.exceptionFields, fieldPath) {
logger.Warnf("Found exception field, skip its validation (not in preview): %q", fieldPath)
logger.Warnf("Found exception field, skip its validation (not present in preview): %q", fieldPath)
return nil
}

Expand All @@ -572,7 +572,7 @@ func (v *MappingValidator) validateMappingsNotInPreview(currentPath string, chil
}

if isEmptyObject(def) {
logger.Debugf("Skip empty object path: %q", fieldPath)
logger.Debugf("Skip field which value is an empty object: %q", fieldPath)
continue
}

Expand Down Expand Up @@ -609,22 +609,16 @@ func (v *MappingValidator) matchingWithDynamicTemplates(currentPath string, defi
continue
}

logger.Warnf("> Found dynamic template matched: %s", template.name)

logger.Debugf("> Check parameters (%q): %q", template.name, currentPath)
// Check that all parameters match (setting no dynamic templates to avoid recursion)
errs := v.validateObjectMappingAndParameters(template.mapping, definition, currentPath, []map[string]any{}, true)
if errs != nil {
// Look for another dynamic template
logger.Warnf(">> Invalid dynamic template for %q:\n%s", currentPath, errs.Unique())
continue
}

logger.Warnf("> Valid template for path %q: %q", currentPath, template.name)
return nil
}

logger.Warnf(">> No template matching for path: %q", currentPath)
return fmt.Errorf("no template matching for path: %q", currentPath)
}

Expand Down