• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aserto-dev / topaz / 12144694970
0%

Build:
DEFAULT BRANCH: main
Ran 03 Dec 2024 05:14PM UTC
Jobs 1
Files 0
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Dec 2024 05:10PM UTC coverage: 0.0%. Remained the same
12144694970

push

github

web-flow
Builtins emit default values in JSON results (#507)

The `ds.checks` builtin returns an array of `CheckResponse` messages.
Each element has a boolean `check` field indicating the outcome of one check.
However, because `false` is the default value for `bool` the marshaled JSON
object doesn't include the `check` field at all when it is false.

Dealing with missing fields is difficult in Rego (I couldn't figure it out).
The code below takes a resource context of the form:
```json
{
  "object_type": "",
  "checks": [
    {"object_id": "", "relation": ""}
  ]
}
```

It computes an array of results of the form:
```json
[
  {"object_id": "", "relation": "", "allowed": true/false}
]
```

If default values are omitted from the returned results, the array
will only include checks that evaluated to true.

```rego
raw := ds.checks({
  "default": {
    "object_type": input.resource.object_type,
    "subject_type": "user",
    "subject_id": input.user.id
  },
  "checks": checks
})

results := x {
  x := [
    {"object_id": check.object_id, "relation": check.relation, "allowed": result.check } |
    check := checks[i]
    result = raw[i]
  ]
}
```

This commit adds `EmitDefaultValues: true` to the `protojson.MarshalOptions` used by the
builtins to marshal rpc responses to JSON.

0 of 0 relevant lines covered (NaN%)

0.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 12144694970.1 03 Dec 2024 05:14PM UTC 0
0.0
GitHub Action Run
Source Files on build 12144694970
Detailed source file information is not available for this build.
  • Back to Repo
  • 7627ee2a on github
  • Prev Build on main (#12144388917)
  • Next Build on main (#12163171313)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc