mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
af3678f6cf
## Description Incremental pass on #3786: add `PlaygroundExample` blocks for a handful of frequently used built-ins that had no examples yet. | Built-in | Example | |---|---| | `units.parse` | Compare container memory limits expressed with different unit suffixes | | `object.get` | Read an optional label with a default (`env` → `dev`) | | `startswith` | Restrict HTTP paths to `/api/v1/` | | `sprintf` | Build a deny message with user/role/action/resource | | `intersection` | Check required OAuth-style scopes are present | | `array.concat` | Merge a base registry allowlist with tenant extras | Each example follows the existing layout under `docs/docs/policy-reference/_examples/` (`policy.rego`, `input.json`, `intro.md`, `output.json`, …). Outputs were generated with `opa eval` (same approach as `docs/bin/eval-examples.sh`). `units.parse` was suggested in the issue thread as a good starting point. ## Checklist - [x] I have read the [contribution guidelines](https://www.openpolicyagent.org/docs/latest/contributing/). - [x] I have added/updated tests for my change (docs-only; examples evaluate cleanly with `opa eval`). - [x] All new/updated docs follow the existing style of nearby examples (`count`, `sum`, `contains`, …). Closes nothing by itself — this is partial progress on #3786. --------- Signed-off-by: Dean Chen <51218137+locker95@users.noreply.github.com> Signed-off-by: Dean Chen <862469039@qq.com>
7 lines
86 B
JSON
7 lines
86 B
JSON
{
|
|
"showInput": true,
|
|
"showData": false,
|
|
"showTitles": false,
|
|
"titleSize": 4
|
|
}
|