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

thema: Try to return a concrete result from #Translate #157

Merged
merged 2 commits into from
May 18, 2023
Merged

Conversation

joanlopez
Copy link
Contributor

It adds a call to Default() after calling the CUE #Translate to try to return a concrete result, and deal with inconsistently-shaped instances from Translate and Validate, as described in #155.

It also adds a regression test specifically checking what's described on the issue.

Fixes #155

@joanlopez joanlopez self-assigned this May 18, 2023
@@ -174,8 +174,10 @@ func (i *Instance) Translate(to SyntacticVersion) (*Instance, TranslationLacunas
lac := make(multiTranslationLacunas, 0)
out.LookupPath(cue.MakePath(cue.Str("lacunas"))).Decode(&lac)

raw, _ := out.LookupPath(cue.MakePath(cue.Str("result"), cue.Str("result"))).Default()
Copy link
Contributor

Choose a reason for hiding this comment

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

this is...slightly bizarre, let's make sure to add a comment indicating why the Default() call is there. Especially given that this is tightly coupled to the current implementation approach for #Translate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Comment added!

Copy link
Contributor

@sdboyer sdboyer left a comment

Choose a reason for hiding this comment

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

excellent, LGTM!

@sdboyer sdboyer merged commit 3adcb5f into main May 18, 2023
2 checks passed
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.

bug: inconsistently-shaped instances from Translate and Validate
2 participants