Merge pull request #481 from wking/state-schema
schema/state.json: Add a JSON Schema for the state JSON
This commit is contained in:
commit
2f0fa18f12
|
@ -2,13 +2,14 @@
|
|||
|
||||
## Overview
|
||||
|
||||
This directory contains the [JSON Schema](http://json-schema.org/) for
|
||||
validating the `config.json` of this container runtime specification.
|
||||
This directory contains the [JSON Schema](http://json-schema.org/) for validating JSON covered by this specification.
|
||||
|
||||
The layout of the files is as follows:
|
||||
* [schema.json](schema.json) - the primary entrypoint for the whole schema document
|
||||
* [schema-linux.json](schema-linux.json) - this schema is for the Linux-specific sub-structure
|
||||
* [schema-solaris.json](schema-solaris.json) - this schema is for the Solaris-specific sub-structure
|
||||
|
||||
* [config-schema.json](config.json) - the primary entrypoint for the [configuration](../config.md) schema
|
||||
* [config-linux.json](config-linux.json) - the [Linux-specific configuration sub-structure](../config-linux.md)
|
||||
* [config-solaris.json](config-solaris.json) - the [Solaris-specific configuration sub-structure](../config-solaris.md)
|
||||
* [state-schema.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
|
||||
|
@ -16,8 +17,8 @@ The layout of the files is as follows:
|
|||
|
||||
## Utility
|
||||
|
||||
There is also included a simple utility for facilitating validation of a
|
||||
`config.json`. To build it:
|
||||
There is also included a simple utility for facilitating validation.
|
||||
To build it:
|
||||
|
||||
```bash
|
||||
export GOPATH=`mktemp -d`
|
||||
|
@ -35,5 +36,5 @@ make validate
|
|||
Then use it like:
|
||||
|
||||
```bash
|
||||
./validate schema.json <yourpath>/config.json
|
||||
./validate config-schema.json <yourpath>/config.json
|
||||
```
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"ociVersion": {
|
||||
"description": "The version of OpenContainer specification configuration complies with",
|
||||
"id": "https://opencontainers.org/schema/bundle/ociVersion",
|
||||
"type": "string"
|
||||
"$ref": "defs.json#/definitions/ociVersion"
|
||||
},
|
||||
"hooks": {
|
||||
"id": "https://opencontainers.org/schema/bundle/hooks",
|
||||
|
@ -25,15 +24,7 @@
|
|||
}
|
||||
},
|
||||
"annotations": {
|
||||
"id": "https://opencontainers.org/schema/bundle/annotations",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "defs.json#/definitions/mapStringString"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
"$ref": "defs.json#/definitions/annotations"
|
||||
},
|
||||
"hostname": {
|
||||
"id": "https://opencontainers.org/schema/bundle/hostname",
|
||||
|
@ -166,10 +157,10 @@
|
|||
}
|
||||
},
|
||||
"linux": {
|
||||
"$ref": "schema-linux.json#/linux"
|
||||
"$ref": "config-linux.json#/linux"
|
||||
},
|
||||
"solaris": {
|
||||
"$ref": "schema-solaris.json#/solaris"
|
||||
"$ref": "config-solaris.json#/solaris"
|
||||
}
|
||||
},
|
||||
"required": [
|
|
@ -155,6 +155,20 @@
|
|||
"source",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"ociVersion": {
|
||||
"description": "The version of Open Container Runtime Specification that the document complies with",
|
||||
"type": "string"
|
||||
},
|
||||
"annotations": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/mapStringString"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"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/runtime/state/ociVersion",
|
||||
"$ref": "defs.json#/definitions/ociVersion"
|
||||
},
|
||||
"id": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/id",
|
||||
"description": "the container's ID",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/status",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"created",
|
||||
"running",
|
||||
"stopped"
|
||||
]
|
||||
},
|
||||
"pid": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/pid",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"bundlePath": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/bundlePath",
|
||||
"type": "string"
|
||||
},
|
||||
"annotations": {
|
||||
"$ref": "defs.json#/definitions/annotations"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ociVersion",
|
||||
"id",
|
||||
"status",
|
||||
"pid",
|
||||
"bundlePath"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue