8.2 Approach
First, we’ll need some additional modules. The jsonschema
module defines a validator that can be used to confirm a document matches the defined schema.
Additionally, the Pydantic module provides a way to create class definitions that can emit JSON Schema definitions, saving us from having to create the schema manually. In most cases, manual schema creation is not terribly difficult. For some cases, though, the schema and the validation rules might be challenging to write directly, and having Python class definitions available can simplify the process.
This needs to be added to the requirements-dev.txt
file so other developers know to install it.
When using conda to manage virtual environments, the command might look like the following:
% conda install jsonschema pydantic
When using other tools to manage virtual environments, the command might look like the following:
% python -m pip install jupyterlab
The JSON Schema package requires some supplemental type stubs...