Skip to content

Conversation

pgavlin
Copy link
Member

@pgavlin pgavlin commented Apr 24, 2025

And add a couple of helper methods: one to remove trace metadata from values and one to remove all metadata from an Environment. This allows embedders to more easily provide less heavyweight representations of evaluated values.

And add a couple of helper methods: one to remove trace metadata from
values and one to remove all metadata from an Environment. This allows
embedders to more easily provide less heavyweight representations of
evaluated values.
@pgavlin pgavlin added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Apr 24, 2025
@pgavlin pgavlin requested review from nyobe and komalali April 24, 2025 03:48
@pgavlin
Copy link
Member Author

pgavlin commented Apr 24, 2025

Part of the motivation here is the potential to add support in the ESC API for returning an opened environment in a form that does not include this metadata. The metadata-free form is likely to be easier to consume for most API-level users.

@pgavlin pgavlin requested a review from borisschlosser April 24, 2025 03:54
Copy link

@borisschlosser borisschlosser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Let me know your thoughts where we can leverage these changes in ESC.

@nyobe
Copy link
Contributor

nyobe commented Apr 30, 2025

I think rather than stripping metadata, it might be nice to have a helper that converts an esc.Value tree into a go value. I think users asking for a simpler representation probably just want a direct mapping to the shape the environment defines.

Then we don't lossily drop metadata, we just provide a convenience mapping for direct lookups when desired.

Edit: actually we already have this with the ToJSON() helper!

@pgavlin
Copy link
Member Author

pgavlin commented Apr 30, 2025

Edit: actually we already have this with the ToJSON() helper!

Yes--we already have ToJSON. This is intended to allow us to do something similar to ToJSON at the REST API level but maintain secret-ness metadata.

It could be that we should just add a parameter to the REST API that allows all metadata to be discarded (i.e. call ToJSON and return the result). I just don't love dropping the secret-ness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants