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

opa parse: Allow source location to be provided in output #3143

Closed
anderseknert opened this issue Feb 10, 2021 · 3 comments · Fixed by #5576
Closed

opa parse: Allow source location to be provided in output #3143

anderseknert opened this issue Feb 10, 2021 · 3 comments · Fixed by #5576
Assignees

Comments

@anderseknert
Copy link
Member

Expected Behavior

To enable better tooling around the OPA AST, it would be helpful if the opa parse command could include source locations in the output.. either by default or when provided a flag, like --location or --include-location.

@tsandall tsandall added this to TODO (Things That Should Be Done) in Open Policy Agent via automation Mar 4, 2021
@anderseknert
Copy link
Member Author

Just to provide a bit more background here. While an easy fix would be just changing the "-" serialization directives on the structs in policy.go, we likely won't want all serialization to contain location (as this will be verbose to say the least), so inclusion of location must be conditional.

Something like this, but preferably without introducing a new dependency just for this. A custom marshaling function could also be used, but it would need to traverse the full AST and not just the top nodes.

@tsandall tsandall removed this from Backlog in Open Policy Agent Dec 2, 2021
@stale
Copy link

stale bot commented Jan 2, 2022

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.

@charlieegan3
Copy link
Contributor

charlieegan3 commented Jan 19, 2023

I have a PR open for this here: #5576. See discussion there for my thoughts on the implementation and the suggested approach above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants