Skip to content

Commit a792182

Browse files
committed
fix: Doesn't backtick-quote custom default values, back to the way originally implemented
1 parent 0e09ed3 commit a792182

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

example-charts/custom-template/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ culpa qui officia deserunt mollit anim id est laborum.
2929
| controller.image.tag | string | `"18.0831"` | |
3030
| controller.ingressClass | string | `"nginx"` | Name of the ingress class to route through this controller |
3131
| controller.name | string | `"controller"` | |
32-
| controller.persistentVolumeClaims | list | `["default", "specified", "here"]` | List of persistent volume claims to create. For very long comments, break them into multiple lines. |
32+
| controller.persistentVolumeClaims | list | the chart will construct this list internally unless specified | List of persistent volume claims to create. For very long comments, break them into multiple lines. |
3333
| controller.podLabels | object | `{}` | The labels to be applied to instances of the controller pod |
3434
| controller.publishService.enabled | bool | `false` | Whether to expose the ingress controller to the public world |
3535
| controller.replicas | int | `nil` | Number of nginx-ingress pods to load balance between |

example-charts/custom-template/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ controller:
66

77
# controller.persistentVolumeClaims -- List of persistent volume claims to create.
88
# For very long comments, break them into multiple lines.
9-
# @default -- ["default", "specified", "here"]
9+
# @default -- the chart will construct this list internally unless specified
1010
persistentVolumeClaims: []
1111

1212
extraVolumes:

example-charts/special-characters/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ Source code can be found [here](https://github.com/norwoodj/helm-docs/tree/maste
1515
| elasticsearch.clusterHealthCheckParams | string | `"wait_for_status=yellow&timeout=1s"` | The Elasticsearch cluster health status params that will be used by readinessProbe command |
1616
| elasticsearch.clusterHealthCheckParamsDescription | string | `""` | Now let's put some special characters in the description: wait_for_status=yellow&timeout=1s |
1717
| htmlSnippets.one | string | `"<html>\n <head></head>\n <body>\n <h1>Is this right, I don't know html</h1>\n </body>\n</html>\n"` | |
18-
| htmlSnippets.three | string | `"<html><head></head></html>"` | Another description |
18+
| htmlSnippets.three | string | "<html><head></head></html>" | Another description |
1919
| htmlSnippets.two | string | `""` | Let's put it in the description <html></html> |

pkg/document/values.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ func createValueRow(
116116
return valueRow{}, fmt.Errorf("failed to marshal default value for %s to json: %s", key, err)
117117
}
118118

119-
defaultValue = string(jsonEncodedValue)
119+
defaultValue = fmt.Sprintf("`%s`", jsonEncodedValue)
120120
}
121121

122122
return valueRow{
123123
Key: key,
124124
Type: getTypeName(value),
125-
Default: fmt.Sprintf("`%s`", defaultValue),
125+
Default: defaultValue,
126126
Description: description.Description,
127127
}, nil
128128
}

pkg/document/values_test.go

+23-23
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,22 @@ oscar: 3.14159
123123

124124
assert.Equal(t, "echo", valuesRows[0].Key)
125125
assert.Equal(t, intType, valuesRows[0].Type, intType)
126-
assert.Equal(t, "`some`", valuesRows[0].Default)
126+
assert.Equal(t, "some", valuesRows[0].Default)
127127
assert.Equal(t, "echo", valuesRows[0].Description)
128128

129129
assert.Equal(t, "foxtrot", valuesRows[1].Key)
130130
assert.Equal(t, boolType, valuesRows[1].Type)
131-
assert.Equal(t, "`explicit`", valuesRows[1].Default)
131+
assert.Equal(t, "explicit", valuesRows[1].Default)
132132
assert.Equal(t, "foxtrot", valuesRows[1].Description)
133133

134134
assert.Equal(t, "hello", valuesRows[2].Key)
135135
assert.Equal(t, stringType, valuesRows[2].Type)
136-
assert.Equal(t, "`default`", valuesRows[2].Default)
136+
assert.Equal(t, "default", valuesRows[2].Default)
137137
assert.Equal(t, "hello", valuesRows[2].Description)
138138

139139
assert.Equal(t, "oscar", valuesRows[3].Key)
140140
assert.Equal(t, floatType, valuesRows[3].Type)
141-
assert.Equal(t, "`values`", valuesRows[3].Default)
141+
assert.Equal(t, "values", valuesRows[3].Default)
142142
assert.Equal(t, "oscar", valuesRows[3].Description)
143143
}
144144

@@ -212,12 +212,12 @@ oscar: dog
212212

213213
assert.Equal(t, "oscar", valuesRows[0].Key)
214214
assert.Equal(t, stringType, valuesRows[0].Type)
215-
assert.Equal(t, "`default`", valuesRows[0].Default)
215+
assert.Equal(t, "default", valuesRows[0].Default)
216216
assert.Equal(t, "oscar", valuesRows[0].Description)
217217

218218
assert.Equal(t, "recursive.echo", valuesRows[1].Key)
219219
assert.Equal(t, stringType, valuesRows[1].Type)
220-
assert.Equal(t, "`custom`", valuesRows[1].Default)
220+
assert.Equal(t, "custom", valuesRows[1].Default)
221221
assert.Equal(t, "echo", valuesRows[1].Description)
222222
}
223223

@@ -291,7 +291,7 @@ oscar: dog
291291

292292
assert.Equal(t, "recursive", valuesRows[1].Key)
293293
assert.Equal(t, objectType, valuesRows[1].Type)
294-
assert.Equal(t, "`default`", valuesRows[1].Default)
294+
assert.Equal(t, "default", valuesRows[1].Default)
295295
assert.Equal(t, "an empty object", valuesRows[1].Description)
296296
}
297297
func TestEmptyList(t *testing.T) {
@@ -361,12 +361,12 @@ echo: cat
361361

362362
assert.Equal(t, "birds", valuesRows[0].Key)
363363
assert.Equal(t, listType, valuesRows[0].Type)
364-
assert.Equal(t, "`explicit`", valuesRows[0].Default)
364+
assert.Equal(t, "explicit", valuesRows[0].Default)
365365
assert.Equal(t, "birds", valuesRows[0].Description)
366366

367367
assert.Equal(t, "echo", valuesRows[1].Key)
368368
assert.Equal(t, stringType, valuesRows[1].Type)
369-
assert.Equal(t, "`default value`", valuesRows[1].Default)
369+
assert.Equal(t, "default value", valuesRows[1].Default)
370370
assert.Equal(t, "echo", valuesRows[1].Description)
371371
}
372372

@@ -436,12 +436,12 @@ cats: [echo, foxtrot]
436436

437437
assert.Equal(t, "cats[0]", valuesRows[0].Key)
438438
assert.Equal(t, stringType, valuesRows[0].Type)
439-
assert.Equal(t, "`explicit`", valuesRows[0].Default)
439+
assert.Equal(t, "explicit", valuesRows[0].Default)
440440
assert.Equal(t, "the black one", valuesRows[0].Description)
441441

442442
assert.Equal(t, "cats[1]", valuesRows[1].Key)
443443
assert.Equal(t, stringType, valuesRows[1].Type)
444-
assert.Equal(t, "`default value`", valuesRows[1].Default)
444+
assert.Equal(t, "default value", valuesRows[1].Default)
445445
assert.Equal(t, "the friendly one", valuesRows[1].Description)
446446

447447
}
@@ -554,12 +554,12 @@ animals:
554554

555555
assert.Equal(t, "animals[0].elements[0]", valuesRows[0].Key)
556556
assert.Equal(t, stringType, valuesRows[0].Type)
557-
assert.Equal(t, "`explicit`", valuesRows[0].Default)
557+
assert.Equal(t, "explicit", valuesRows[0].Default)
558558
assert.Equal(t, "the black one", valuesRows[0].Description)
559559

560560
assert.Equal(t, "animals[0].elements[1]", valuesRows[1].Key)
561561
assert.Equal(t, stringType, valuesRows[1].Type)
562-
assert.Equal(t, "`default`", valuesRows[1].Default)
562+
assert.Equal(t, "default", valuesRows[1].Default)
563563
assert.Equal(t, "the friendly one", valuesRows[1].Description)
564564

565565
assert.Equal(t, "animals[0].type", valuesRows[2].Key)
@@ -569,7 +569,7 @@ animals:
569569

570570
assert.Equal(t, "animals[1].elements[0]", valuesRows[3].Key)
571571
assert.Equal(t, stringType, valuesRows[3].Type)
572-
assert.Equal(t, "`value`", valuesRows[3].Default)
572+
assert.Equal(t, "value", valuesRows[3].Default)
573573
assert.Equal(t, "the sleepy one", valuesRows[3].Description)
574574

575575
assert.Equal(t, "animals[1].type", valuesRows[4].Key)
@@ -622,7 +622,7 @@ animals:
622622

623623
assert.Equal(t, "animals", valuesRows[0].Key)
624624
assert.Equal(t, listType, valuesRows[0].Type)
625-
assert.Equal(t, "`cat and dog`", valuesRows[0].Default)
625+
assert.Equal(t, "cat and dog", valuesRows[0].Default)
626626
assert.Equal(t, "all the animals of the house", valuesRows[0].Description)
627627
}
628628

@@ -646,7 +646,7 @@ animals:
646646

647647
assert.Equal(t, "animals[0]", valuesRows[0].Key)
648648
assert.Equal(t, objectType, valuesRows[0].Type)
649-
assert.Equal(t, "`only cats here`", valuesRows[0].Default)
649+
assert.Equal(t, "only cats here", valuesRows[0].Default)
650650
assert.Equal(t, "all the cats of the house", valuesRows[0].Description)
651651

652652
assert.Equal(t, "animals[1].elements[0]", valuesRows[1].Key)
@@ -704,7 +704,7 @@ animals:
704704

705705
assert.Equal(t, "animals.byTrait", valuesRows[0].Key)
706706
assert.Equal(t, objectType, valuesRows[0].Type)
707-
assert.Equal(t, "`animals, you know`", valuesRows[0].Default)
707+
assert.Equal(t, "animals, you know", valuesRows[0].Default)
708708
assert.Equal(t, "animals listed by their various characteristics", valuesRows[0].Description)
709709
}
710710

@@ -773,22 +773,22 @@ animals:
773773

774774
assert.Equal(t, "animals", valuesRows[0].Key)
775775
assert.Equal(t, objectType, valuesRows[0].Type)
776-
assert.Equal(t, "`some`", valuesRows[0].Default)
776+
assert.Equal(t, "some", valuesRows[0].Default)
777777
assert.Equal(t, "animal stuff", valuesRows[0].Description)
778778

779779
assert.Equal(t, "animals.byTrait", valuesRows[1].Key)
780780
assert.Equal(t, objectType, valuesRows[1].Type)
781-
assert.Equal(t, "`explicit`", valuesRows[1].Default)
781+
assert.Equal(t, "explicit", valuesRows[1].Default)
782782
assert.Equal(t, "animals listed by their various characteristics", valuesRows[1].Description)
783783

784784
assert.Equal(t, "animals.byTrait.friendly", valuesRows[2].Key)
785785
assert.Equal(t, listType, valuesRows[2].Type)
786-
assert.Equal(t, "`default`", valuesRows[2].Default)
786+
assert.Equal(t, "default", valuesRows[2].Default)
787787
assert.Equal(t, "the friendly animals of the house", valuesRows[2].Description)
788788

789789
assert.Equal(t, "animals.byTrait.friendly[0]", valuesRows[3].Key)
790790
assert.Equal(t, stringType, valuesRows[3].Type)
791-
assert.Equal(t, "`value`", valuesRows[3].Default)
791+
assert.Equal(t, "value", valuesRows[3].Default)
792792
assert.Equal(t, "best cat ever", valuesRows[3].Description)
793793
}
794794

@@ -935,12 +935,12 @@ fullNames:
935935

936936
assert.Equal(t, `fullNames."John Norwood"`, valuesRows[0].Key)
937937
assert.Equal(t, stringType, valuesRows[0].Type)
938-
assert.Equal(t, "`default`", valuesRows[0].Default)
938+
assert.Equal(t, "default", valuesRows[0].Default)
939939
assert.Equal(t, "who am I", valuesRows[0].Description)
940940

941941
assert.Equal(t, `websites."stupidchess.jmn23.com"`, valuesRows[1].Key)
942942
assert.Equal(t, stringType, valuesRows[1].Type)
943-
assert.Equal(t, "`value`", valuesRows[1].Default)
943+
assert.Equal(t, "value", valuesRows[1].Default)
944944
assert.Equal(t, "status of the stupidchess website", valuesRows[1].Description)
945945
}
946946

0 commit comments

Comments
 (0)