Flask API Validation Mastery in 30 Minutes

Опубликовано: 26 Март 2026
на канале: Demos Petsas
2,301
40

In this video flask marshmallow tutorial we will introduce flask-marshmallow and marshmallow-sqlalchemy. flask-marshmallow is a Flask extension that uses marshmallow a python data validation and serialisation package for validating the data that comes from an http request as well as serialising the data from your application back to json. marshmallow-sqlalchemy makes it easy to serialise your sqlalchemy models back to json without a lot of boilerplate code.

Chapters:
00:00 Intro
00:30 Install dependencies
01:09 Add extensions
01:58 Seed the database
02:53 Create User schema
06:16 Serialize model to json
08:08 Exclude columns in schema
08:40 Validate request data
10:28 Handle Validation exceptions
13:36 Extra field validation rules
17:59 Custom field validation method
20:54 Create model using validated data
22:36 Updating user using schema
26:30 Custom validation error messages

Code:
https://github.com/demoskp/flask-mars...

Personal website:
http://www.petsas.consulting