A set of JSON schemas for various OpenShift versions, extracted from the OpenAPI definitions
OTHER License
For the upstream Kubernetes schemas instead see garethr/kubernetes-json-schema.
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 OpenShift versions. For each specified versions you should find three different flavours:
Here are the links to the latest deployment
schemas for OpenShift 1.5.1:
There are lots of use cases for these schemas, they are primarily useful as a low-level part of other developer workflow tools. But at a most basic level you can validate a definition file.
Here is a very simply example using the Python jsonschema client and an invalid deployment file:
$ jsonschema -F "{error.message}" -i hello-nginx.json 1.5.1-standalone/deployment.json
u'template' is a required property
As noted these schemas have lots of potential uses for development tools. Here are a few ideas, some of which I've been hacking on:
The discussion around wanting JSON Schemas for Kubernetes types has cropped up in a few places, but there are some useful comments on this issue. Jol Harkes reached a similar conclusion to the approach I ended up taking.
The tooling for generating these schemas is openapi2jsonschema. It's not Kubernetes specific and should work with other OpenAPI specificied APIs too.