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 @@ -65,7 +65,10 @@ func (c configureGenieSpaceSerializedSpace) Apply(_ context.Context, b *bundle.B
// KindInvalid means serialized_space is absent (neither it nor
// file_path is set); leave it for backend validation to reject.
return v, nil
case dyn.KindMap, dyn.KindSequence:
case dyn.KindMap:
// A top-level sequence would be valid JSON but is meaningless for a
// genie space, so KindSequence is not accepted here and falls through
// to the default rejection below.
jsonBytes, err := json.Marshal(ss.AsAny())
if err != nil {
return dyn.InvalidValue, fmt.Errorf("failed to marshal inline serialized_space: %w", err)
Expand All @@ -74,7 +77,7 @@ func (c configureGenieSpaceSerializedSpace) Apply(_ context.Context, b *bundle.B
default:
diags = diags.Append(diag.Diagnostic{
Severity: diag.Error,
Summary: fmt.Sprintf("serialized_space must be a string, map, or sequence, got %s", ss.Kind()),
Summary: fmt.Sprintf("serialized_space must be a string or map, got %s", ss.Kind()),
Locations: ss.Locations(),
})
return v, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ func TestConfigureGenieSpaceSerializedSpace(t *testing.T) {
name: "non-structured serialized_space is rejected",
setSerialized: true,
serializedSpace: true,
wantErr: "serialized_space must be a string, map, or sequence, got bool",
wantErr: "serialized_space must be a string or map, got bool",
},
{
// A top-level sequence is valid JSON but meaningless for a genie space,
// so it is rejected rather than marshaled like an inline map.
name: "inline sequence is rejected",
setSerialized: true,
serializedSpace: []any{map[string]any{"version": 1}},
wantErr: "serialized_space must be a string or map, got sequence",
},
{
name: "unreadable file_path is an error",
Expand Down
Loading