Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for typename import aliases #993

Merged
merged 2 commits into from
Aug 10, 2024

Conversation

TristonianJones
Copy link
Collaborator

@TristonianJones TristonianJones commented Aug 2, 2024

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 TristonianJones requested a review from l46kok August 2, 2024 04:44
@TristonianJones
Copy link
Collaborator Author

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

policy/parser.go Outdated Show resolved Hide resolved
policy/testdata/pb/policy.yaml Outdated Show resolved Hide resolved
@TristonianJones TristonianJones force-pushed the policy-imports branch 2 times, most recently from fbe8397 to b2bfca8 Compare August 2, 2024 22:59
@TristonianJones
Copy link
Collaborator Author

PTAL

@TristonianJones TristonianJones merged commit 851a4b8 into google:master Aug 10, 2024
2 checks passed
@TristonianJones TristonianJones deleted the policy-imports branch August 10, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants