Maintainers feel (and I agree) that there's no point in explicitly allowing a null value when callers can simply leave the property unset [1]. This commit removes all references to "pointer" and "null" from the JSON Schema to support that decision. While optional properties may sometimes be represented as pointer types in Go [2], optional properties should be represented in JSON Schema by not including the properties in the 'required' array. [1]: https://github.com/opencontainers/runtime-spec/pull/555#issuecomment-272020515 [2]: style.md "Optional settings should not have pointer Go types" Signed-off-by: W. Trevor King <wking@tremily.us> |
||
---|---|---|
.. | ||
Makefile | ||
README.md | ||
config-linux.json | ||
config-schema.json | ||
config-solaris.json | ||
config-windows.json | ||
defs-linux.json | ||
defs-windows.json | ||
defs.json | ||
state-schema.json | ||
validate.go |
README.md
JSON schema
Overview
This directory contains the JSON Schema for validating JSON covered by this specification.
The layout of the files is as follows:
- config-schema.json - the primary entrypoint for the configuration schema
- config-linux.json - the Linux-specific configuration sub-structure
- config-solaris.json - the Solaris-specific configuration sub-structure
- config-windows.json - the Windows-specific configuration sub-structure
- state-schema.json - the primary entrypoint for the state JSON schema
- defs.json - definitions for general types
- defs-linux.json - definitions for Linux-specific types
- validate.go - validation utility source code
Utility
There is also included a simple utility for facilitating validation. To build it:
export GOPATH=`mktemp -d`
go get -d ./...
go build ./validate.go
rm -rf $GOPATH
Or you can just use make command to create the utility:
make validate
Then use it like:
./validate config-schema.json <yourpath>/config.json
Or like:
./validate https://raw.githubusercontent.com/opencontainers/runtime-spec/v1.0.0-rc1/schema/schema.json <yourpath>/config.json