Skip to content

Is the import statement fully supported? #284

Closed
@lquerel

Description

In Regorus, the following code works.

package semconv
import rego.v1

# Collect all attributes from previous groups that are prefixed by "registry."
prev_attributes := {attr.name | 
    some g in data.groups
    startswith(g.id, "registry.")
    some attr in g.attributes
}

# Collect all attributes from current groups that are prefixed by "registry."
curr_attributes := {attr.name | 
    some g in input.groups
    startswith(g.id, "registry.")
    some attr in g.attributes
}

prev_group_id_containing_attr := {attr.name: g.id |
    some g in data.groups
    startswith(g.id, "registry.")
    some attr in g.attributes
}

But not this one (see the import with the alias).
Note that the official implementation doesn't complain with this code. Is there something I'm missing?

package semconv
import rego.v1

# HERE I DEFINED AN ALIAS TO data.groups 
import data.groups as prev_groups

# Collect all attributes from previous groups that are prefixed by "registry."
prev_attributes := {attr.name | 
    some g in prev_groups
    startswith(g.id, "registry.")
    some attr in g.attributes
}

# Collect all attributes from current groups that are prefixed by "registry."
curr_attributes := {attr.name | 
    some g in input.groups
    startswith(g.id, "registry.")
    some attr in g.attributes
}

prev_group_id_containing_attr := {attr.name: g.id |
    some g in prev_groups
    startswith(g.id, "registry.")
    some attr in g.attributes
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions