Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: unique schema type for `StreamMediaOutput` (#5387)

Akshay Agrawal904e7c26ff4d
diff --git a/marimo/_schemas/generated/session.yaml b/marimo/_schemas/generated/session.yaml
index 95c58b5f20..fdfdf5bb9d 100644
--- a/marimo/_schemas/generated/session.yaml
+++ b/marimo/_schemas/generated/session.yaml
@@ -115,7 +115,7 @@ components:
type: string
type:
enum:
- - stream
+ - streamMedia
type: string
required:
- type
diff --git a/marimo/_schemas/session.py b/marimo/_schemas/session.py
index d61a3c6d16..4637dfa4c5 100644
--- a/marimo/_schemas/session.py
+++ b/marimo/_schemas/session.py
@@ -1,4 +1,13 @@
# Copyright 2025 Marimo. All rights reserved.
+"""This file contains the schema for the notebook session.
+
+It may be externally used and must be kept backwards compatible.
+
+* We generate the OpenAPI schema using a marimo notebook: `python scripts/generate_schemas.py`
+* We generate frontend types using `make fe-codegen`
+* We check for backwards compatibility using a GitHub action: `.github/workflows/test_schemas.yaml`
+"""
+
from __future__ import annotations
from typing import Any, Literal, Optional, Union
@@ -6,13 +15,6 @@ from typing import Any, Literal, Optional, Union
from marimo._messaging.mimetypes import KnownMimeType
from marimo._schemas.common import BaseDict
-# This file contains the schema for the notebook session.
-# It may be externally used and must be kept backwards compatible.
-#
-# We generate the OpenAPI schema using a marimo notebook: `python scripts/generate_schemas.py`
-# We generate frontend types using `make fe-codegen`
-# We check for backwards compatibility using a GitHub action: `.github/workflows/test_schemas.yaml`
-
# Metadata types
class TimeMetadata(BaseDict):
@@ -22,6 +24,8 @@ class TimeMetadata(BaseDict):
# Output types
+#
+# NB: No two outputs can have the same `type` field.
class StreamOutput(BaseDict):
type: Literal["stream"]
name: Literal["stdout", "stderr"]
@@ -29,7 +33,7 @@ class StreamOutput(BaseDict):
class StreamMediaOutput(BaseDict):
- type: Literal["stream"]
+ type: Literal["streamMedia"]
name: Literal["media"]
data: str
mimetype: KnownMimeType
diff --git a/marimo/_server/session/serialize.py b/marimo/_server/session/serialize.py
index c9d30bc840..945927d15c 100644
--- a/marimo/_server/session/serialize.py
+++ b/marimo/_server/session/serialize.py
@@ -95,7 +95,7 @@ def serialize_session_view(view: SessionView) -> NotebookSessionV1:
if console_out.channel == CellChannel.MEDIA:
console.append(
StreamMediaOutput(
- type="stream",
+ type="streamMedia",
name="media",
mimetype=console_out.mimetype,
data=str(console_out.data),
diff --git a/openapi/src/session.ts b/openapi/src/session.ts
index d2259dc20b..88f1c0498a 100644
--- a/openapi/src/session.ts
+++ b/openapi/src/session.ts
@@ -68,7 +68,7 @@ export interface components {
/** @enum {string} */
name: "media";
/** @enum {string} */
- type: "stream";
+ type: "streamMedia";
};
StreamOutput: {
/** @enum {string} */