'OPA test coverage schema?

What is the schema of the JSON returned by a call to opa test --coverage? And is there a tool I can use to create a human-friendly coverage report?



Solution 1:[1]

I don't think there's any formal schema to the JSON output, but the struct that builds the coverage report per file can be found here.

The tools I'm aware of that can visualize the coverage are UI's like the VS Code plugin, the Rego Playground or Styra DAS.

If you'd like to use other available tooling, you could probably write something similar to the JUnit conversion script found in the OPA contrib repo, but for the coverage report, and have that exported into some other coverage format.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Devoops