Module intercom_python_sdk.core.schema_base

Schema Base Classes

core/schema_base.py

Extensible schemas applicable to all APIS.

Expand source code
"""
# Schema Base Classes

`core/schema_base.py`

Extensible schemas applicable to all APIS.
"""
# External
import marshmallow


class SchemaBase(marshmallow.Schema):
    """
    Base schema for all API schemas.
    """

    class Meta:
        """
        Defines Meta options for schemas.

        See https://marshmallow.readthedocs.io/en/stable/marshmallow.schema.html#marshmallow.schema.Schema.Meta
        """
        unknown = marshmallow.EXCLUDE  # Exclude unknown fields from deserialization

    def to_dict(self):
        return {name: type(field).__name__ for name, field in self.fields.items()}

Classes

class SchemaBase (*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)

Base schema for all API schemas.

Expand source code
class SchemaBase(marshmallow.Schema):
    """
    Base schema for all API schemas.
    """

    class Meta:
        """
        Defines Meta options for schemas.

        See https://marshmallow.readthedocs.io/en/stable/marshmallow.schema.html#marshmallow.schema.Schema.Meta
        """
        unknown = marshmallow.EXCLUDE  # Exclude unknown fields from deserialization

    def to_dict(self):
        return {name: type(field).__name__ for name, field in self.fields.items()}

Ancestors

  • marshmallow.schema.Schema
  • marshmallow.base.SchemaABC
  • abc.ABC

Subclasses

Class variables

var Meta
var opts

Methods

def to_dict(self)
Expand source code
def to_dict(self):
    return {name: type(field).__name__ for name, field in self.fields.items()}