google / cel-go

Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)
https://cel.dev
Apache License 2.0
2.3k stars 224 forks source link

Support for typename import aliases #993

Closed TristonianJones closed 3 months ago

TristonianJones commented 3 months ago

Allow users to specify type name imports in policies.

Imported types are aliased by the simple type name:

# Create an import alias to `TypeName`
imports:
  - name: my.custom.really.ridiculously.long.package.TypeName

rule:
  match:
    - output: "TypeName{}"

As a future refinement, the imports will support a custom alias to allow for alias disambiguation between types which come from different packages but have the same simple name.

TristonianJones commented 3 months ago

FYI @seirl, I've added proper support for this feature.

TristonianJones commented 3 months ago

PTAL