Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve typing of sync-v2 messages #725

Open
glevco opened this issue Jul 26, 2023 · 0 comments
Open

Improve typing of sync-v2 messages #725

glevco opened this issue Jul 26, 2023 · 0 comments

Comments

@glevco
Copy link
Contributor

glevco commented Jul 26, 2023

I couldn't find any kind of schema validation related to the sending/receiving of messages, if I'm not mistaken it looks like we could KeyError here. I think the solution would be more robust if we type-hinted all this, as any value retrieved from data is not typed and therefore cannot be type checked.

This impacts not only this method, but every method where any message is sent or received. I know it's not a small change, but in my opinion this is important and affects long term maintainability, as currently there's no easy way to perform refactors like changing/adding/removing attributes to the message schemas, as there are no static type checking guarantees.

We could leverage pydantic models and validations to tie messages to well defined schemas, like I did for reliable integration websocket messages, for example.

Originally posted by @glevco in #275 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants