Skip to content

FieldInfo

🛈 DocStrings

How a model field behaves on the wire.

Source code in src/aclientp/schema_reference.py
@dataclass(frozen=True)
class FieldInfo:
    """How a model field behaves on the wire."""

    required: bool
    """The field must be present when parsing."""

    omittable: bool
    """The field can be left out when serializing: optional with a ``None`` or
    ``MISSING`` default."""

    accepts_none: bool
    """The annotation allows ``None`` (sent as ``null`` unless excluded)."""

    constraints: dict[str, float]
    """Numeric and length constraints, e.g. ``{"ge": 1}``."""

accepts_none instance-attribute

accepts_none: bool

The annotation allows None (sent as null unless excluded).

constraints instance-attribute

constraints: dict[str, float]

Numeric and length constraints, e.g. {"ge": 1}.

omittable instance-attribute

omittable: bool

The field can be left out when serializing: optional with a None or MISSING default.

required instance-attribute

required: bool

The field must be present when parsing.

:fa-brands-github: Show source on GitHub