Skip to content

Property

🛈 DocStrings

One field of an :class:ObjectNode.

Source code in src/promptantic/form/nodes.py
@dataclass(frozen=True)
class Property:
    """One field of an :class:`ObjectNode`."""

    name: str
    node: FormNode
    required: bool
    title: str | None = None
    """The field's own title; the node's title may be that of a referenced schema."""

    @property
    def label(self) -> str:
        """The field's title, else its name as words (``ship_to`` -> ``Ship To``)."""
        return self.title or self.name.replace("_", " ").title()

label property

label: str

The field's title, else its name as words (ship_to -> Ship To).

title class-attribute instance-attribute

title: str | None = None

The field's own title; the node's title may be that of a referenced schema.

:fa-brands-github: Show source on GitHub