Skip to content

Commit

Permalink
Dirty-fix for known bug jsonnet-libs#307: Ignore keys containing '$'.
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolPavl committed Nov 21, 2024
1 parent 8e05c15 commit d44bb56
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/builder/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package builder

import (
"fmt"
"log"
"strings"
)

Expand Down Expand Up @@ -82,6 +83,7 @@ func (o ObjectType) ConciseString() string {

func printChildren(children map[string]Type, order []string, s string) string {
j := ""
order = removeStringsWithDollar(order)
for _, name := range order {
c := children[name]
colon := ":"
Expand Down Expand Up @@ -119,3 +121,15 @@ func printChildren(children map[string]Type, order []string, s string) string {
j = strings.TrimSuffix(j, s)
return j
}

func removeStringsWithDollar(input []string) []string {
var result []string
for _, str := range input {
if !strings.Contains(str, "$") {
result = append(result, str)
} else {
log.Default().Printf("Warning: %s contains a '$' and has been ommited from final libsonnet as a temporary fix", str)
}
}
return result
}

0 comments on commit d44bb56

Please sign in to comment.