-
Notifications
You must be signed in to change notification settings - Fork 773
schema: add config/image JSON schema and validation #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6e049d2 to
7a6d374
Compare
Signed-off-by: Sergiusz Urbaniak <[email protected]>
Signed-off-by: Sergiusz Urbaniak <[email protected]>
This implements the validation for the config/image JSON format. Signed-off-by: Sergiusz Urbaniak <[email protected]>
Fixes opencontainers#74 Signed-off-by: Sergiusz Urbaniak <[email protected]>
7a6d374 to
7884a28
Compare
| "type": "string" | ||
| }, | ||
| "config": { | ||
| "$ref": "defs-config.json#/definitions/config" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s-urbaniak I've filed #83. Feel free to expand on anything I've missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is recursive here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, so. Not working is an understandable concern. I just did not see recursion. :-)
schema/spec_test.go
Outdated
| } | ||
|
|
||
| for _, example := range examples { | ||
| if example.Err == errFormatInvalid { // ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
|
@jonboulle PTAL |
|
LGTM |
| "properties": { | ||
| "created": { | ||
| "type": "string", | ||
| "format": "date-time" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this format too strict for "2015-10-31T22:22:56.015925234Z"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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