Abstract
Developers often mess up the validation steps of the payloads from API requests. Following a systematic way to setup the validator and keep code clean is crucial. A decorator is a function that takes another function as an argument and extends its behavior without explicitly modifying it. Validator-as-a-decorator is an ideal approach for function-based APIs since the validation always happens before the API call happens. It is also reusable and prevent the need of changing the API implementation itself. In this talk, I'll first use a Flask (web framework) + Cerberus (3rd-party data validation library) example to demo the steps of building a Validator-as-a-decorator. The other part of the talk, I'll compare different data validation library in both functionality and restriction aspects, also briefly mention how other web frameworks (Django/FastAPI) deal with request payload validation.
Description
Video
Location
R1
Date
Day 1 • 12:55-13:25 (GMT+8)
Language
English talk
Level
Intermediate
Category
Python Core