Update config sanity check for xmldp

Before it included paths starting with prefixes other than
~*req which is incorrect.
This commit is contained in:
ionutboangiu
2024-02-28 02:36:36 -05:00
committed by Dan Christian Bogos
parent 48f4ef1f90
commit 0ee816a3f0
2 changed files with 2 additions and 1 deletions

View File

@@ -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))

View File

@@ -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},