Why does JSON Schema validate so many things? Add More Constraints!

preview_player
Показать описание
JSON Schema is an important tool for constraining JSON documents. It can be used to describe constraints for JSON data structures and therefore is a widely used language in the API space, for example by describing the constraints for APIs defined in OpenAPI and AsyncAPI. However, sometimes the behavior of JSON Schema can be a bit surprising, in particular for people not used to schema languages and constraint systems.
Henry Andrews, co-author of the JSON Schema specification, describes the differences between the constraint approach of JSON Schema and what developers and in particular users of strictly types languages (such as Java) may be used to. JSON Schema can be a very useful tool for developers in various scenarios, but like with every tool, it's important to know the general idea underlying the tool so that you can use it as intended.
We also talk about validation pipelines in scenarios where just using the constraints of JSON Schema may not be sufficient. In these cases, using annotations can be a useful way of combining an initial validation step based on JSON Schema which is then followed by additional validation logic.

Рекомендации по теме
Комментарии
Автор

Hi @Erik, Your guest @Henry is really knowledgeable, hope you bring him on for more talks where we learn like in this video

DreamsAPI
Автор

those JSON schemas are used a lot in Kafka to read from topics that are JSON encoded, at least some familiar to me

pazaresosset
Автор

{
"type": "object",
"properties": {
"mustSee": {
"type": "boolean"
},
"required": [ "mustSee" ],
"default": true
}
}

jeremyfiel