Skip to content

dialog_data: support adaptix and dataclasses #527

@bomzheg

Description

@bomzheg

Many problems we have with serialization/deserialization data in/from storage
I guess about 90% my bugs when i use aiogram-dialog is forgotten serde.

Plan:
Add a dataclass type as optional field to dialog/window and lib should use it for deserialization before handler and serialization after getter.
If provided both (for dialog and window) use for window, i guess (or an error)

@dataclass
class Form
    name: str | None = None
    age: str | None = None
    pets_names: list[str] = field(default_factory=list)


form_dialog = Dialog(
    Window(
        model=None, # of course optional field
    ),
    data_model=Form,
    start_data_model=...
)

if no dataclass provided - should deserialize as is in current release for backward compatibility

Also we should serialize start_data, i guess only for dialog it will be enough.

retort should be provided with setup_dialogs and if no - created default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions