From ef4c6b0aa5a5a21cf5e07cf4f07ecec26e070793 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 1 Jun 2016 15:53:57 -0700 Subject: [PATCH] schema/state.json: Add a JSON Schema for the state JSON Signed-off-by: W. Trevor King --- schema/README.md | 2 ++ schema/state.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 schema/state.json diff --git a/schema/README.md b/schema/README.md index 1f5d41ba0..d5fd01987 100644 --- a/schema/README.md +++ b/schema/README.md @@ -6,9 +6,11 @@ This directory contains the [JSON Schema](http://json-schema.org/) for validating the `config.json` of this container runtime specification. The layout of the files is as follows: + * [config.json](config.json) - the primary entrypoint for the [`config.json`](../config.md) schema * [config-linux.json](config-linux.json) - the [Linux-specific sub-structure](../config-linux.md) * [config-solaris.json](config-solaris.json) - the [Solaris-specific sub-structure](../config-solaris.md) +* [state.json](state.json) - the primary entrypoint for the [state JSON](../runtime.md#state) schema * [defs.json](defs.json) - definitions for general types * [defs-linux.json](defs-linux.json) - definitions for Linux-specific types * [validate.go](validate.go) - validation utility source code diff --git a/schema/state.json b/schema/state.json new file mode 100644 index 000000000..cbe9f5551 --- /dev/null +++ b/schema/state.json @@ -0,0 +1,42 @@ +{ + "description": "Open Container Runtime State Schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "id": "https://opencontainers.org/schema/state", + "type": "object", + "properties": { + "ociVersion": { + "id": "https://opencontainers.org/schema/state/ociVersion", + "$ref": "defs.json#/definitions/ociVersion" + }, + "id": { + "id": "https://opencontainers.org/schema/state/id", + "description": "the container's ID", + "type": "string" + }, + "status": { + "id": "https://opencontainers.org/schema/state/status", + "type": "string", + "enum": [ + "created", + "running", + "stopped" + ] + }, + "pid": { + "id": "https://opencontainers.org/schema/state/pid", + "type": "integer", + "minimum": 0 + }, + "bundlePath": { + "id": "https://opencontainers.org/schema/state/bundlePath", + "type": "string" + } + }, + "required": [ + "ociVersion", + "id", + "status", + "pid", + "bundlePath" + ] +}