An Introduction to JSON Schema: A Practical Look
Автор: Erik Wilde
Загружено: 23 мар. 2022 г.
Просмотров: 14 438 просмотров
This introduction to JSON Schema features Simon Plenderleith walking viewers through some examples of how to use JSON Schema for practical JSON validation. As an independent Node.js consultant, Simon frequently uses JSON Schema and shares with us some examples to get started with JSON Schema.
We start by introducing a basic JSON Schema for validating a request payload, using cooking recipes as an example. In the first example we introduce the JSON Schema concepts of $schema, keywords, types, and required properties.
The next step is to improve the schema for recipes by turning the ingredients into a JSON array. For this, we extend the basic JSON Schema to validate the updated property which now is an array. This demonstrates how to add a sub schema to validate the items in an array.
The final step is to introduce references withing the schema, turning the recipe model into one that recursively allows ingredients to be complete recipes. This demonstrates how in JSON Schema complete schema or specific parts of schemas can be reused.
All the materials shown in this video are available online, and here also are additional links to some of the things mentioned in the video:
Code examples in this video: https://github.com/simonplend/talks/t...
JSON Schema: https://json-schema.org/
Ajv JSON schema validator: https://ajv.js.org/
Fastify Node.js web framework: https://www.fastify.io/
Understanding JSON Schema: https://json-schema.org/understanding...
Tutorial: Get started with validation in Node.js: https://simonplend.com/get-started-wi...
Simon's website: https://simonplend.com/
Simon on Twitter: / simonplend
00:00 Introduction
00:56 JSON Schema usage as a developer
01:42 How complicated is it to get started with JSON Schema?
03:58 JSON Schema implementations in Node.js
05:40 Getting started with the examples
06:12 A simple JSON Schema for validating a recipe
14:12 Which types does JSON Schema have?
15:41 JSON Schema validation in action
20:15 Improving the JSON Schema by using an array
26:48 Using recursion in JSON Schema
33:09 Wrapping it up

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: