CacheControl / CacheControl/json-rules-engine

Support for optional object properties

Abierto
#217 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
3.1k
Forks
507
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Let's say we have the following Fact:
```
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}
```
The following rule snippet should return true in my understanding:

```
{
fact: 'a',
path: `$..phoneNumbers..title`,
operator: 'doesNotContain',
value: 'SOMETITLE'
},
```

However this will evaluate to false, as "title" is not present in the object.
The actual use case I have is that the dynamic fact ist an array of objects which can be an empty array sometimes (due to input params for the fact).

Supporting this use case would be very valuable, otherwise additional custom operators are necessary.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.