Skip to content

Conversation

@charlieegan3
Copy link
Contributor

  • added link to playground
  • removed some examples I felt were redundant
  • made the constants example relevant to the example domain
  • minor wording changes and fixes

1. Servers reachable from the Internet must not expose the insecure 'http' protocol.
2. Servers are not allowed to expose the 'telnet' protocol.
```
> 1. Servers reachable from the Internet must not expose the insecure 'http' protocol.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blockquotes have no hscroll

All the servers, networks, and ports are provisioned by a script. The script
receives a JSON representation of the system as input:
All the servers, networks, and ports are provisioned using infrastructure as
code. The infrastructure configuration is specified in this JSON representation:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's 2025, people don't use scripts any more right? 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha

This section covers the building blocks of writing policies in Rego. You can see
how these concepts come together to solve our network security policy in the
[Complete Example](#complete-example).
:::
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i felt this was needed since the section here is not 100% on the task of building the final example.


You can omit the `;` (AND) operator by splitting expressions across multiple
lines. The following query has the same meaning as the previous one:
Multiple expressions can be combined using logical AND. For queries to produce
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt this section was too much detail, so I have condensed it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will people understand that we're referring to ; as the AND operator here? This is a place where Rego diverges from most other languages people are used to.
Maybe its more clear if we just drop the Multiple expressions can be combined using logical AND part(?).

@netlify
Copy link

netlify bot commented Jul 30, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 23ecc4d
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/688b2b1a2f624b00082636cb
😎 Deploy Preview https://deploy-preview-7805--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

output if {
input.servers[0].id == "app"
// highlight-next-line
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what needed the style changes, they looked dark to me on lightmode.


<RunSnippet files="#input.json" command="data.servers.output"/>

Variables are immutable. OPA reports an error if you try to assign the same
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mention they're immutable above now, and felt this was too much detail for the homepage.

```

<RunSnippet files="#input.json" command="data.servers.output"/>
`[{"id": "net1", "public": false}, {"id": "net2", "public": false}, ...]`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just included what the data looks like rather than an example that is there with a button just to click to see it.


<RunSnippet files="#input.json" command="data.servers.http_server"/>

Providing good names for variables can be hard. If you only refer to the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd prefer the some in style here so have removed, mostly to save reading time.

the example above `exists_public_network := true` is the head and `some net in input.networks; net.public` is the body.

You can query for the value generated by rules just like any other value:
You can query for the value generated by rules just like any other value (such as `input` or your own variables):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to repeat too much code in the prose.

package servers
pi := 3.14
max_allowed_protocols := 5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seemed more relevant than pi. even if pi is the best constant ever.

Congratulations on making it through the introduction to OPA. If you made it
this far you have learned the core concepts behind OPA's policy language as well
as how to get OPA and run it on your own.
Congratulations on completing the introduction to OPA. You have learned the core
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'making it though' 😆

that is how I felt by this point...

@charlieegan3 charlieegan3 changed the title docs: Revise index page wording docs: Revise docs index page wording Jul 30, 2025
Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍


You can omit the `;` (AND) operator by splitting expressions across multiple
lines. The following query has the same meaning as the previous one:
Multiple expressions can be combined using logical AND. For queries to produce
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will people understand that we're referring to ; as the AND operator here? This is a place where Rego diverges from most other languages people are used to.
Maybe its more clear if we just drop the Multiple expressions can be combined using logical AND part(?).

Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! It's about time that this page gets some attention and careful edits. 🙌 Nicely done.

In the example above `public_network contains net.id if` is the rule head and
`some net in input.networks; net.public` is the rule body. You can query for the entire
set of values just like any other value. Using the `in` keyword we can use this
<RunSnippet id="public_network_set.rego" files="#input.json" command="data.example"/> Using the `in` keyword we can use this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<RunSnippet id="public_network_set.rego" files="#input.json" command="data.example"/> Using the `in` keyword we can use this
<RunSnippet id="public_network_set.rego" files="#input.json" command="data.example"/>
Using the `in` keyword we can use this

Charlie Egan added 2 commits July 31, 2025 08:36
- added link to playground
- removed some examples I felt were redundant
- made the constants example relevant to the example domain
- minor wording changes and fixes

Signed-off-by: Charlie Egan <[email protected]>
Signed-off-by: Charlie Egan <[email protected]>
@charlieegan3
Copy link
Contributor Author

Thanks both for the review, have patched that up now.

@charlieegan3 charlieegan3 merged commit 4647660 into open-policy-agent:main Jul 31, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants