I’ve been a fan of Railroad syntax diagrams for a long time. I’ve always found them an easy way to understand the syntactical options and the reserved/keywords in an efficient manner.
I have been digging around in the documentation to find a keyword in the OCI Policies syntax that the common cases don’t use. After a bit of rooting around, I found what I needed. But a Railroad representation would have helped me get the expression correct effortlessly and without so much effort.
The policy documentation can be found at:
- https://docs.oracle.com/en-us/iaas/Content/Identity/Concepts/policysyntax.htm
- https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm
- https://docs.oracle.com/en-us/iaas/Content/Identity/policyreference/policyreference.htm
Once I solved my problem, I decided to see if I could find something that could easily create the railroad diagrams and encountered a fantastic bit of code on GitHub from Tab Atkins Jr. It’s a neat bit of JavaScript, which can even be run from their GitHub pages – go here. Tab has taken the time to document the tool well, so working out the syntax to define the diagram is straightforward (not that you need to read it much as the tool is well written).
The following diagrams show the syntax for writing OCI Policies in a single image and with the full syntax broken into 2 images to make it a little easier to read on the screen. But also address the fact often you don’t need the Where clause.
If the diagrams need to be updated the source to use with the tools is in my GitHub repository. But a really cool feature of the utility is that the information to populate the editor view is included in the URL (does make for a long URL) but it means this link will take you directly to the view & editor if you want to tinker with the definition. So the links are:
- Single diagram
- Two Part diagram
Single diagram View

Split (2 Part) View

Pingback: Interpreting Railroad diagrams | Phil (aka MP3Monster)'s Blog