jsonschema is an implementation of the JSON Schema specification for Python.
When it comes to data exchange, JSON Schema stands out as a powerful standard for defining the structure and rules of JSON data. It uses a set of keywords to define the properties of your data.
While JSON Schema provides the language, validating a JSON instance against a schema requires a JSON Schema validator. The JSON validator checks if the JSON documents conform to the schema.
JSON Schema Validators are tools that implement the JSON Schema specification. Such tooling enables easy integration of JSON Schema into projects of any size.
While exploring tooling for Kubernetes I had need for schemas to describe the definition files, and went looking for something that didn't require either kubectl or similar installed or even a working Kubernetes installation.
It turns out that the OpenAPI specification contain this information, but not in a particularly usable format for tools which might just want a raw JSON Schema.
This repository contains a set of schemas for most recent Kubernetes versions. For each specified Kubernetes versions you should find four different flavours:
vX.Y.Z - URL referenced based on the specified GitHub repository
vX.Y.Z-standalone - de-referenced schemas, more useful as standalone documents
vX.Y.Z-local - relative references, useful to avoid the network dependency
vX.Y.Z-strict - prohibits properties not defined in the schema
Note that the Kubernetes API allows additional properties to be submitted, but kubectl acts like the strict flavour above.
jsonschema is an implementation of JSON Schema for Python (supporting 2.7+ including Python 3).
Features
- Full support for Draft 6, Draft 4 and Draft 3
- Lazy validation that can iteratively report all validation errors.
- Small and extensible
- Programmatic querying of which properties or items failed validation.