{"categories":[{"label":"Application Frameworks","url":"https://skillfed.io/packages/category/software-development-libraries-application-frameworks/4"}],"enrichment":{"capability":"Extends Marshmallow with a PolyField class that handles serialization and deserialization of polymorphic types by selecting the appropriate schema based on the object's runtime type.","skillfed_tags":["serialization","polymorphism","marshmallow-extension"],"use_cases":["Serialize REST API responses where a single field holds different object types.","Build schemas for heterogeneous collections where each item's schema depends on its type.","Handle polymorphic data in JSON APIs where type discrimination is based on attributes.","Implement type-aware serialization in inheritance hierarchies with custom per-type handling.","Deserialize incoming data by inspecting its structure to determine which schema to apply."],"what_it_does":"Marshmallow-Polyfield is an unofficial extension to Marshmallow that adds support for polymorphic fields\u2014fields that can hold objects of different types and serialize/deserialize them appropriately. Instead of defining a single schema for a field, you provide two selector functions: one that examines an object during serialization and returns the correct schema, and another that examines incoming data during deserialization and returns the correct schema. This allows you to handle heterogeneous data structures where a single field might contain different object types that each need their own serialization logic.\n\nThe package integrates with Marshmallow's standard field properties like `required`, `allow_none`, and `many`, so polymorphic fields behave like any other Marshmallow field in your schema. It targets Marshmallow 3.0 and above and supports Python >= 3.5. The package has no external runtime dependencies beyond Marshmallow itself.","worth_installing":"Yes, if you are already using Marshmallow 3.0+ and need polymorphic field support. The package is permissively licensed, has no external dependencies, and is stable for its intended use. However, it has been dormant since 2022-10-26 with no active maintenance\u2014install only if you can tolerate potential incompatibilities with future Marshmallow releases."},"id":"marshmallow-polyfield","links":{"html":"https://skillfed.io/packages/marshmallow-polyfield","md":"https://skillfed.io/packages/marshmallow-polyfield.md","pypi":"https://pypi.org/project/marshmallow-polyfield/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2022-10-26","license_spdx":null,"license_treatment":"permissive","name":"marshmallow-polyfield","python_support":"supports_current","summary":"An unofficial extension to Marshmallow to allow for polymorphic fields"},"popularity":{"monthly_downloads":174935,"position":10275,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"5.11"}
