Skip to content

Add keywords_in_refs capability to allow reserved keywords as dot-notation field names #741

@mrymcginty

Description

@mrymcginty

Regorus's parser rejects Rego reserved keywords (as, default, else, if, import, in, not, package, some, with, plus several v1 additions like every, true, false, null) when used after a . as field names. For example:

allow if {
input.v0.package.format == "npm"
}
Regorus rejects this with error: expected ident (or similar) at input.v0.package because package is a reserved keyword.

OPA accepts this syntax via the keywords_in_refs capability, which is enabled by default in standard OPA builds. The semantic ambiguity is resolved in OPA's parser because the position after . is unambiguously a field name, not a statement-level keyword.

Would it be possible to add a configuration option to the Regorus Engine to opt into the same behavior?

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions