Skip to content

refactor(backend): switch to pydantic from marshmallow - #1076

Draft
mikonse wants to merge 1 commit into
TomBursch:mainfrom
mikonse:milo/pydantic-refactoring
Draft

mikonse wants to merge 1 commit into
TomBursch:mainfrom
mikonse:milo/pydantic-refactoring

Conversation

@mikonse

@mikonse mikonse commented May 23, 2026

Copy link
Copy Markdown
Contributor

As a proposal for a longer refactoring with the end goal of moving from flask + marshmallow to fastapi + pydantic this would be the first step to refactor the API datamodels from marshmallow to pydantic.

The idea behind this switch in framework / underlying library for me is that pydantic + fastapi produces a much nicer editor experience because you can rely on type checker and editor autocompletion support for the schemas and have a lower chance of getting errors into the API controller code due to typos / type mismatches.

Additionally the currently somewhat manually documented API in the kitchenowl docs could be replaced by the automatic openapi export that fastapi supports with an inline swagger API browser.

@TomBursch I'm very much open to discussion about this. If this is something you would be interested to see I'm happy to drive this forward and open pulls along the way. I'll try to keep this as multi stage refactors so we would have multiple sets of changes instead of one big change to fastapi.

@mikonse
mikonse force-pushed the milo/pydantic-refactoring branch 2 times, most recently from 7795dae to 72d0c0b Compare May 26, 2026 21:04
@TomBursch

Copy link
Copy Markdown
Owner

I'm not sure about the FastAPI migration, but Pydantic instead of Marshmallow is a good change

@mikonse

mikonse commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Sounds good, I'll have a look when I get time to rebase this pydantic branch onto the most recent changes and test it on my personal deployment 👍

Regarding the fastapi changes, I've also had a look at that and while I think in the longterm it would provide a better development experience than flask it is by far not as easy a drop in replacement as marshmallow -> pydantic due to the additional number of flask based plugins which this project uses.
But maybe I'll keep playing around and give you a ping if I've found a way to migrate without to huge a churn and a better gauge of what the main benefits would be.

@mikonse
mikonse force-pushed the milo/pydantic-refactoring branch from 72d0c0b to 46923fc Compare September 5, 2026 20:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants