From 0ee816a3f0893e3230a8683346847b93047aa8e0 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Wed, 28 Feb 2024 02:36:36 -0500 Subject: [PATCH] Update config sanity check for xmldp Before it included paths starting with prefixes other than ~*req which is incorrect. --- config/configsanity.go | 2 +- config/configsanity_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/configsanity.go b/config/configsanity.go index deb7ca227..5c4772025 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -521,7 +521,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { // Find the minimum rule length for dynamic RSRParser within the field value. minRuleLength := math.MaxInt for _, parser := range field.Value { - if !strings.HasPrefix(parser.Rules, utils.DynamicDataPrefix) { + if !strings.HasPrefix(parser.Rules, utils.DynamicDataPrefix+utils.MetaReq) { continue } ruleLen := len(strings.Split(parser.Rules, utils.NestingSep)) diff --git a/config/configsanity_test.go b/config/configsanity_test.go index 7018a27bc..5606a7e6d 100644 --- a/config/configsanity_test.go +++ b/config/configsanity_test.go @@ -888,6 +888,7 @@ func TestConfigSanityERsXmlRootPath(t *testing.T) { "flags": ["*dryrun"], "xml_root_path": "A.B", "fields":[ + {"tag": "VariableFldNoReq", "path": "*cgreq.VariableFldNoReq", "type": "*variable", "value": "~*vars.C", "mandatory": true}, {"tag": "VariableFld", "path": "*cgreq.VariableFld", "type": "*variable", "value": "~*req.A.B.Value1", "mandatory": true}, {"tag": "ComposedFld", "path": "*cgreq.ComposedFld", "type": "*composed", "value": "~*req.A.B.Value2", "mandatory": true}, {"tag": "ComposedFld", "path": "*cgreq.ComposedFld", "type": "*composed", "value": "_", "mandatory": true},