16 lines
1.3 KiB
Markdown
Raw Normal View History

# JSON Schema
2021-08-13 20:12:38 +00:00
2021-10-15 03:51:13 +05:30
We use [JSON schema](https://json-schema.org) as the Schema Definition Language as it offers several advantages:
2021-08-13 20:12:38 +00:00
2021-10-15 03:51:13 +05:30
* **Easy to describe the structure and semantics** of metadata models with readable documentation that is both human and machine consumable.
* Common types can be developed once and can be reused as building blocks in other schemas and become the basis of **vocabulary development**.
* Models can include **structural validation**, such as required/optional fields, default values, allowed values, regex that not only serve as automated testing and validation but also as documentation of API contract.
* **A rich set of tools are available** that supports JSON schema support for generating code and validation from JSON schema in various languages, reducing the manual boilerplate coding.
2021-11-30 22:44:54 +01:00
* **Supports rich formats** to convert schema types into native standard types during code generation, such as URI, date, and time.
2021-08-13 20:12:38 +00:00
## Reference
2021-10-15 03:51:13 +05:30
1. [JSON schema](https://json-schema.org) specification version [Draft-07 to 2019-099](https://json-schema.org/draft/2019-09/release-notes.html)
2. [JSON schema 2 POJO](https://www.jsonschema2pojo.org) tool used for Java code generation from JSON schema
2021-08-13 20:12:38 +00:00
3. [Data model code generator](https://github.com/koxudaxi/datamodel-code-generator) for generating python code from JSON schema