marshmallow-oneofschema
marshmallow multiplexing schema
Decision gist · record as of 2026-08-14
Yes. The package solves a genuine gap in marshmallow's core functionality (polymorphic schema support), has low install friction, active maintenance, no security issues, and permissive licensing. Install it if you need to serialize or deserialize multiple object types through a single schema interface.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; marshmallow must be installed as a runtime dependency.
- Low friction: pure Python wheel with a single runtime dependency on marshmallow.
- Actively maintained with recent releases and no known vulnerabilities.
License · maintenance · safety
permissive license (permissive) — MIT licensed under permissive terms, allowing use in commercial and proprietary projects with minimal restrictions.
last release 2025-05-08 (463 days) · last repo commit 2026-08-03 · 142 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 6,637,373 downloads/mo, #1,877 on PyPI
Alternatives
Verify before relying
pip install marshmallow-oneofschema
from marshmallow_oneofschema import OneOfSchema
import marshmallow
class MyUberSchema(OneOfSchema):
type_schemas = {"Foo": FooSchema, "Bar": BarSchema}
MyUberSchema().dump([Foo(foo="hello"), Bar(bar=123)], many=True)- Whether the package handles deeply nested polymorphic structures or only single-level type discrimination.
- Performance characteristics when type_schemas contains many schema definitions.
What it is and what it does
marshmallow-oneofschema is a plugin for the marshmallow serialization library that adds support for polymorphic schemas—schemas that can serialize and deserialize objects of different types by routing each object to the appropriate type-specific schema. When serializing, it inspects the object type, looks up the corresponding schema from a type-to-schema mapping, and adds a discriminator field (by default named 'type') to the output. Deserialization reverses this: it reads the discriminator field to determine which schema to use for reconstructing the object.
The library is designed to integrate seamlessly with marshmallow's existing API, allowing OneOfSchema instances to be nested within other schemas and used anywhere a standard marshmallow schema would work. It requires only marshmallow as a runtime dependency and supports Python 3.9 and later. The project is actively maintained, has no known security vulnerabilities, and is widely used in the Python ecosystem.
Use it for
- Serialize and deserialize REST API responses containing multiple object types under a single endpoint.
- Handle database records of different entity types (e.g., User, Admin, Guest) with a single schema interface.
- Build event systems where events can be of different types but need uniform serialization.
- Implement discriminated union types in data pipelines that process heterogeneous object streams.
- Validate and transform polymorphic data structures in configuration or data migration tools.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package solves a genuine gap in marshmallow's core functionality (polymorphic schema support), has low install friction, active maintenance, no security issues, and permissive licensing. Install it if you need to serialize or deserialize multiple object types through a single schema interface.
Install
marshmallow-oneofschema on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency on marshmallow. Actively maintained with recent releases and no known vulnerabilities.
Requires Python 3.9 or later; marshmallow must be installed as a runtime dependency.
License in practice
MIT licensed under permissive terms, allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install marshmallow-oneofschema
from marshmallow_oneofschema import OneOfSchema
import marshmallow
class MyUberSchema(OneOfSchema):
type_schemas = {"Foo": FooSchema, "Bar": BarSchema}
MyUberSchema().dump([Foo(foo="hello"), Bar(bar=123)], many=True)
Verify before relying
- Whether the package handles deeply nested polymorphic structures or only single-level type discrimination.
- Performance characteristics when type_schemas contains many schema definitions.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagemarshmallow |
| Maintenance | Actively maintained 463 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,637,373 / month, #1,877 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9 |
Evidence: marshmallow_oneofschema-3.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “marshmallow oneofschema”
- marshmallow-oneofschemaExtends marshmallow to handle polymorphic serialization and…
- apispec-oneofschemaExtends apispec to generate OpenAPI 3.0+ documentation for…
- marshmallow-fastoneofschemaExtends marshmallow to handle polymorphic schema (de)serialization by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Application Frameworks packages
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.
Install it if you're developing CLI tools, dashboards, or interactive terminal applications.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.
Install it if you need to build or connect to servers.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
See also apispec-oneofschema · marshmallow-fastoneofschema · marshmallow-polyfield · DeepFriedMarshmallow · marshmallow · marshmallow-mongoengine · marshmallow-union · marshmallow-jsonschema · marshmallow-jsonapi · flask-marshmallow