refactor(backend): switch to pydantic from marshmallow#1076
Draft
mikonse wants to merge 1 commit into
Draft
Conversation
0a7de00 to
7795dae
Compare
7795dae to
72d0c0b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.