schema: add config/image JSON schema and validation#81
Conversation
6e049d2 to
7a6d374
Compare
Signed-off-by: Sergiusz Urbaniak <sur@coreos.com>
Signed-off-by: Sergiusz Urbaniak <sur@coreos.com>
This implements the validation for the config/image JSON format. Signed-off-by: Sergiusz Urbaniak <sur@coreos.com>
Fixes opencontainers#74 Signed-off-by: Sergiusz Urbaniak <sur@coreos.com>
7a6d374 to
7884a28
Compare
| "type": "string" | ||
| }, | ||
| "config": { | ||
| "$ref": "defs-config.json#/definitions/config" |
There was a problem hiding this comment.
This is probably outside the scope of this PR: let's make sure we have some negative examples of the config to ensure that the validation is working with these recursively definitions. I know I had some issues with this when I first started experimenting with the validators.
There was a problem hiding this comment.
👍 I have this on my radar, as well as the support for providing the erroneous line number in case of validation failure.
There was a problem hiding this comment.
@s-urbaniak I've filed #83. Feel free to expand on anything I've missed.
There was a problem hiding this comment.
@vbatts config-schema.json pulls in defs-config.json. During my experimentation, I was not convinced this was working correctly. Either way, we should have negative examples to confirm this and ensure that bad schemas are actually being rejected.
There was a problem hiding this comment.
ah, so. Not working is an understandable concern. I just did not see recursion. :-)
| } | ||
|
|
||
| for _, example := range examples { | ||
| if example.Err == errFormatInvalid { // ignore |
There was a problem hiding this comment.
There are many examples/snippets in the spec not meant for validation.
Hmm, but you're right, we should only ignore if there is no MediaType set.
Signed-off-by: Sergiusz Urbaniak <sur@coreos.com>
|
@jonboulle PTAL |
|
LGTM |
| "properties": { | ||
| "created": { | ||
| "type": "string", | ||
| "format": "date-time" |
There was a problem hiding this comment.
is this format too strict for "2015-10-31T22:22:56.015925234Z"?
There was a problem hiding this comment.
On Mon, May 23, 2016 at 01:51:33PM -0700, Vincent Batts wrote:
- "created": {
"type": "string","format": "date-time"is this format too strict for
"2015-10-31T22:22:56.015925234Z"?
The v4 JSON Schema RFC doesn't mention date-time 1, but it's listed
here 2 referencing RFC 3339, section 5.6. And your string is
compatible with that 3.
|
overall LGTM, but a couple of questions |
|
LGTM |
1 similar comment
|
LGTM |
Fixes #74