Closed Gorgho closed 4 years ago
What do you think, @tiagostutz @jairsjunior @abilioesteves?
@Gorgho could you please send a real example on this?
@rafamarts
@flaviostutz, I think this is a Domain Specific Issue, meaning only the client app would know the behaviour it wants to see.
Although it's a weak link, we do have a semantic relationship between client apps
and rule groups
as heavily suggested by feature-dsl
's examples.
Based on that, we could add to each rule group a boolean lazyEvaluation
field that tells the Ruller the right evaluation behaviour for a specific group:
lazyEvaluation == true
: if a required input is not provided, return error;lazyEvaluation == false
: if a required input is not provided, evaluates all the conditions that does not makes use of such input;What do you think?
I think that is a good option has the property lazyEvaluation
because with this the evaluation can be not so strict if the client app permits.
Indeed, I think this would be a DSL option, not a feature for the core ruller. It would be a "config" option on the json itself or something. Lets continue this discussion here: https://github.com/flaviostutz/ruller-dsl-feature-flag/issues/11
So, what do you think about placing this option at the "config" node of the rules json? Something like:
{
"_config": {
"seed": 123,
"default_condition": true,
"lazy_evaluation": false,
"flatten": true,
},
"_items": [{
"provider": "aws",
"_condition": "randomPerc(10, input:customerid)",
"_items": [{
"region": "sa-east-1",
"login": "login.sa-east-1.test.com",
"bootcamp": "bootcamp.sa-east-1.test.com",
"_condition": "input:_ip_country=='Brazil'"
},
{
"region": "us-west-1",
"login": "login.us-west-1.test.com",
"events": "events.us-west-1.test.com",
"bootcamp": "bootcamp.us-west-1.test.com"
}
]
},
{
"provider": "azure",
"_condition": "randomPercRange(10, 50, input:customerid)",
"_items": [{
"region": "azure-brazil",
"login": "login.azure-brazil.test.com",
"_condition": "input:_ip_country=='Brazil'"
},
{
"region": "azure-ny",
"login": "login.azure-ny.test.com",
"events": "events.azure-ny.test.com",
"bootcamp": "bootcamp.azure-ny.test.com"
}
]
},
{
"provider": "vpsdime",
"_items": [{
"region": "vpsdime",
"login": "login.vpsdime.test.com",
"events": "events.azure-ny.test.com",
"bootcamp": "bootcamp.azure-ny.test.com"
}]
}
]
}
I suggest "lazy_evaluation" default value to be "false" because we will stop throwing errors when a required input is not present, so that it will be much harder to detect when the caller is sending wrong values to ruller.
What do you think?
For me it is an excellent solucion.
Great!
Now if i send a request without input, i will reicive an error. How about create a default where if condition ask for input and i don't send that, the app continue just not aplly that condition?