allowUndefinedFacts not working when the facts type are string
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- backend
Direzione di ricerca
Inizia eseguendo la riproduzione fornita con Engine.run, un oggetto facts vuoto e allowUndefinedFacts abilitato, quindi traccia il modo in cui l’operatore notEqual gestisce il fact undefined Astring rispetto al fact numerico Bnumber. Il lavoro è completato quando l’opzione si comporta in modo coerente per entrambi i tipi di fact e la riproduzione produce il risultato atteso documentato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Here's my example, you can reproduce the issue with the code:
const customAttributeRule = {
"name": "allowUndefinedFacts-test",
"attributes": [
{
"name": "Astring",
"type": "string"
},
{
"name": "Bnumber",
"type": "number"
}
],
"decisions": [
{
"conditions": {
"all": [
{
"fact": "Astring",
"operator": "notEqual",
"value": "string"
}
]
},
"event": {
"type": "Astring",
"params": {
"value": "1",
"description": "Astring test"
}
}
},
{
"conditions": {
"all": [
{
"fact": "Bnumber",
"operator": "lessThan",
"value": 5
}
]
},
"event": {
"type": "Bnumber",
"params": {
"value": "1",
"description": "Bnumber test"
}
}
}
]
}
let facts = {}
const engine = new Engine(customAttributeRule.decisions, {allowUndefinedFacts: true});
engine.on('success', event => {
console.log(event)
});
let result = engine .run(facts)
The engine output is
{
type: 'Astring',
params: { value: '1', description: 'Astring test' }
}
However, the allowUndefinedFacts works when then fact type is number
Since the engine treat undefined facts as undefined, so I added another condition that {
"fact": "Astring",
"operator": "notEqual",
"value": "undefined"
}, but it still does not work as expected
- Lingua principale
- JavaScript
- Stelle
- 3.1k
- Fork
- 507
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CacheControl/json-rules-engine
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
CacheControl/json-rules-engine#427 · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
CacheControl/json-rules-engine#424 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
CacheControl/json-rules-engine#421 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
CacheControl/json-rules-engine#417 · 1 reazione ·
Tutte le issue di CacheControl/json-rules-engine
Issue simili
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Improve Title Support Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·