Skip to content

Conversation

@spinillos
Copy link
Member

Custom templates could import packages that aren't defined in the main cue file. This change adds the functionality to the template to add the import in the final result.

@spinillos spinillos self-assigned this Jul 14, 2025
@spinillos spinillos requested a review from a team as a code owner July 14, 2025 09:30
@github-actions
Copy link

github-actions bot commented Jul 14, 2025

Note: the diff show code changes that would be introduced by this PR to the output of the config/foundation_sdk.dev.yaml codegen pipeline (dev version of the Foundation SDK).

🔎 Changes to config/foundation_sdk.dev.yaml

diff --new-file --unidirectional-new-file '--color=never' --unified --recursive '--exclude=.git' '--exclude=gradle.properties' '--exclude=pyproject.toml' '--exclude=package.json' '--exclude=*.md' /tmp/foundation-workspace-main/foundation-sdk/java/src/main/java/com/grafana/foundation/azuremonitor/BuilderQueryEditorOperatorTypeDeserializer.java /tmp/foundation-workspace-current/foundation-sdk/java/src/main/java/com/grafana/foundation/azuremonitor/BuilderQueryEditorOperatorTypeDeserializer.java
--- /tmp/foundation-workspace-main/foundation-sdk/java/src/main/java/com/grafana/foundation/azuremonitor/BuilderQueryEditorOperatorTypeDeserializer.java	2025-07-14 14:44:33.838360922 +0000
+++ /tmp/foundation-workspace-current/foundation-sdk/java/src/main/java/com/grafana/foundation/azuremonitor/BuilderQueryEditorOperatorTypeDeserializer.java	2025-07-14 14:43:58.171446411 +0000
@@ -17,6 +17,8 @@
 
 import com.grafana.foundation.cog.variants.Dataquery;
 import com.grafana.foundation.cog.variants.Registry;
+import com.grafana.foundation.dashboard.DataSourceRef;
+import com.grafana.foundation.cog.variants.PanelConfig;
 
 
 import java.io.IOException;

if jenny.tmpl.Exists(customMethodsBlock) {
innerErr = jenny.tmpl.RenderInBuffer(&buffer, customMethodsBlock, map[string]any{
innerErr = jenny.tmpl.Funcs(map[string]any{
"formatPkg": func(pkg string) string {
Copy link
Member

Choose a reason for hiding this comment

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

Why not sticking with existing helper names?
See the builder.go jenny:

"importStdPkg": func(pkg string) string {
return imports.Add(pkg, pkg)
},

@Duologic Duologic removed the request for review from a team October 27, 2025 13:33
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