Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (c configureClusterPolicyDefinition) Apply(_ context.Context, b *bundle.Bun
case dyn.KindInvalid, dyn.KindNil, dyn.KindString:
// KindInvalid means the field is absent; leave it for backend validation.
continue
case dyn.KindMap, dyn.KindSequence:
case dyn.KindMap:
jsonBytes, err := json.Marshal(def.AsAny())
if err != nil {
return dyn.InvalidValue, fmt.Errorf("failed to marshal inline %s: %w", field, err)
Expand All @@ -57,7 +57,7 @@ func (c configureClusterPolicyDefinition) Apply(_ context.Context, b *bundle.Bun
default:
diags = diags.Append(diag.Diagnostic{
Severity: diag.Error,
Summary: fmt.Sprintf("%s must be a string, map, or sequence, got %s", field, def.Kind()),
Summary: fmt.Sprintf("%s must be a string or map, got %s", field, def.Kind()),
Locations: def.Locations(),
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ func TestConfigureClusterPolicyDefinition(t *testing.T) {
want: `{"spark_version":{"type":"fixed","value":"13.3.x"}}`,
},
{
name: "definition: inline sequence is marshaled to a JSON string",
field: "definition",
value: []any{"a", "b"},
want: `["a","b"]`,
name: "definition: inline sequence is rejected",
field: "definition",
value: []any{"a", "b"},
wantErr: "definition must be a string or map, got sequence",
},
{
name: "definition: inline string is left unchanged",
Expand All @@ -47,7 +47,7 @@ func TestConfigureClusterPolicyDefinition(t *testing.T) {
name: "definition: non-structured is rejected",
field: "definition",
value: true,
wantErr: "definition must be a string, map, or sequence, got bool",
wantErr: "definition must be a string or map, got bool",
},
{
// Number stays a JSON number (30, not "30").
Expand All @@ -66,7 +66,7 @@ func TestConfigureClusterPolicyDefinition(t *testing.T) {
name: "overrides: non-structured is rejected",
field: "policy_family_definition_overrides",
value: true,
wantErr: "policy_family_definition_overrides must be a string, map, or sequence, got bool",
wantErr: "policy_family_definition_overrides must be a string or map, got bool",
},
}

Expand Down
Loading