CacheControl / CacheControl/json-rules-engine

Support for optional object properties

未关闭
#217 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
3.1k
派生
507
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

没有指定文件、测试或入口点。使用缺失的标题和空对象数组重现所提供的事实和规则,然后跟踪 JSON 路径和 doesNotContain 评估;当所请求的可选属性用例在不需要自定义运算符的情况下返回预期结果时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
backend
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。