We are two .rego policies, each with their own metadoc properties. Here is one for example:
package rules.aws.tag
__rego__metadoc__ := {
"id": "PL203",
"title": "Resources tags",
"description": "All AWS resources must have tags",
"custom": {
"severity": "High"
}
}
Sphinx-rego extension reads these properties with a simple policy.rst command. Notice that we give a glob pathname to the _:policy: argument, so our two policy files could be in any subdirectory of policy/.
Policy Documentation
=======================================
.. rego::
:policy: ../policy/**/*.rego
The extension generates documentation accordingly: