flaviostutz/ruller-dsl-feature-flag

Code generated with wrong "groupName"

Closed this issue · 1 comments

Using .json file below to generate rules:

{
  "_groups": {

        "dependencias":["1004"],
        "contratos":["523038"]

    },
    "_items": [
        {
            "nomeAplicativo": "TESTE",
            "_condition" : "contains(group:dependencias,input:dependencia)"
        },
        {
            "nomeAplicativo": "TESTE",
            "_condition" : "contains(group:dependencias,input:dependencia)"
        },
        {
            "nomeAplicativo": "TESTE",
            "_condition" : "contains(group:dependencias,input:dependencia)"
        } 
}

But then he outputs the following when generating rules for ruller:

groupContains("piloto","dependencia.(string)s",ctx.Input["dependencia"].(string)) && groupContains("piloto","contrato.(string)s",ctx.Input["contrato"].(string))

when replaced by the correct string ("dependencias" and "contratos") it works.
It looks like a problem with this regex ln.354:

//GROUP REFERENCES TO STRING
//condition="group:members" ---> ""members""
regexp.MustCompile("contains\(\s*group:([a-z0-9
-]+)\s*,\s*([0-9a-z:]+)\s*\)")

Bug resolved at commit revision: 2613904