Skip to content

Commit

Permalink
Merge pull request #184 from sblundy/notation-on-null-values
Browse files Browse the repository at this point in the history
Copy NotationType in Nil Values
  • Loading branch information
norwoodj authored Nov 2, 2023
2 parents eadcfd7 + 5145fd6 commit 4816ed5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/document/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func parseNilValueType(key string, description helm.ChartValueDescription, autoD
return valueRow{
Key: key,
Type: t,
NotationType: autoDescription.NotationType,
AutoDefault: autoDescription.Default,
Default: description.Default,
AutoDescription: autoDescription.Description,
Expand Down
10 changes: 9 additions & 1 deletion pkg/document/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1490,12 +1490,16 @@ animals:
# @notationType -- yaml
fish:
name: nomoby
# -- (list) Declaring object as yaml with null value
# @notationType -- yaml
lizards:
`)

valuesRows, err := getSortedValuesTableRows(helmValues, make(map[string]helm.ChartValueDescription))

assert.Nil(t, err)
assert.Len(t, valuesRows, 4)
assert.Len(t, valuesRows, 5)

assert.Equal(t, "animals.cats", valuesRows[0].Key)
assert.Equal(t, listType, valuesRows[0].Type)
Expand All @@ -1520,6 +1524,10 @@ animals:
assert.Equal(t, yamlType, valuesRows[3].NotationType)
assert.Equal(t, "name: nomoby\n", valuesRows[3].Default)
assert.Equal(t, "My animals lists", valuesRows[0].AutoDescription)

assert.Equal(t, "animals.lizards", valuesRows[4].Key)
assert.Equal(t, listType, valuesRows[4].Type)
assert.Equal(t, yamlType, valuesRows[4].NotationType)
}

func TestExtractCustomDeclaredType(t *testing.T) {
Expand Down

0 comments on commit 4816ed5

Please sign in to comment.