Skip to content

Commit 54f0ec0

Browse files
authored
tools/openapi2crd: do not render jsonpath syntax for sensitive field default keys (#3010)
1 parent 8f51614 commit 54f0ec0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/openapi2crd/pkg/plugins/sensitive_properties.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (p *SensitiveProperties) Process(req *PropertyProcessorRequest) error {
5959

6060
req.Property.Type = "object"
6161
req.Property.Description = fmt.Sprintf("SENSITIVE FIELD\n\nReference to a secret containing data for the %q field:\n\n%v", req.Path[len(req.Path)-1], req.OpenAPISchema.Description)
62-
defaultKey := apiextensions.JSON(".data." + req.Path[len(req.Path)-1])
62+
defaultKey := apiextensions.JSON(req.Path[len(req.Path)-1])
6363
req.Property.Properties = map[string]apiextensions.JSONSchemaProps{
6464
"name": {
6565
Type: "string",

tools/openapi2crd/pkg/plugins/sensitive_properties_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestSensitivePropertyName(t *testing.T) {
3232
}
3333

3434
func TestSensitivePropertyProcess(t *testing.T) {
35-
stringJson := apiextensions.JSON(".data.password")
35+
stringJson := apiextensions.JSON("password")
3636

3737
tests := map[string]struct {
3838
request *PropertyProcessorRequest

0 commit comments

Comments
 (0)