Skip to main content

invalid-metadata-attribute

Summary: Invalid attribute in metadata annotation

Category: Bugs

Avoid

# METADATA
# title: Main policy routing requests to other policies based on input
# category: Routing
package router

Prefer

# METADATA
# title: Main policy routing requests to other policies based on input
# custom:
# category: Routing
package router

Rationale

Metadata comments should follow the schema expected by annotations. Custom attributes, like category above, should be placed under the custom key, which is a map of arbitrary key-value pairs.

While arbitrary attributes are accepted, they will not be treated as metadata annotations but regular comments, and as such won't be available to other tools that process annotations. These tools include built-in functions like rego.metadata.rule and rego.metadata.chain.

Configuration Options

This linter rule provides the following configuration options:

rules:
bugs:
invalid-metadata-attribute:
# one of "error", "warning", "ignore"
level: error

Community

If you think you've found a problem with this rule or its documentation, would like to suggest improvements, new rules, or just talk about Regal in general, please join us in the #regal channel in the Styra Community Slack!