Loading...
「ツール」は右上に移動しました。
利用したサーバー: balsam-secret-fine
32いいね 1351回再生

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

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.

Henry's "Modern JSON Schema (& APIs)" blog: modern-json-schema.com/
Henry's "JSON Schema is a constraint system" blog post: modern-json-schema.com/json-schema-is-a-constraint…
The official JSON Schema blog: json-schema.org/blog
The JSON Schema Slack (good place to ask questions and discuss the spec and how to use it): json-schema.org/slack

コメント