-
Notifications
You must be signed in to change notification settings - Fork 774
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
Changes from all commits
dbfd5ee
8be63a2
9e48c45
7884a28
114d12a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "description": "OpenContainer Config Specification", | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "id": "https://opencontainers.org/schema/image/config", | ||
| "type": "object", | ||
| "properties": { | ||
| "created": { | ||
| "type": "string", | ||
| "format": "date-time" | ||
| }, | ||
| "author": { | ||
| "type": "string" | ||
| }, | ||
| "architecture": { | ||
| "type": "string" | ||
| }, | ||
| "os": { | ||
| "type": "string" | ||
| }, | ||
| "config": { | ||
| "$ref": "defs-config.json#/definitions/config" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is recursive here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vbatts
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. :-) |
||
| }, | ||
| "rootfs": { | ||
| "$ref": "defs-config.json#/definitions/rootfs" | ||
| }, | ||
| "history": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "defs-config.json#/definitions/history" | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was about to comment on the lack of an array of requires, but then the |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "description": "Definitions particular to OpenContainer Config Specification", | ||
| "definitions": { | ||
| "config": { | ||
| "type": "object", | ||
| "properties": { | ||
| "User": { | ||
| "type": "string" | ||
| }, | ||
| "Memory": { | ||
| "$ref": "defs.json#/definitions/int64" | ||
| }, | ||
| "MemorySwap": { | ||
| "$ref": "defs.json#/definitions/int64" | ||
| }, | ||
| "CpuShares": { | ||
| "$ref": "defs.json#/definitions/int64" | ||
| }, | ||
| "ExposedPorts": { | ||
| "$ref": "defs.json#/definitions/mapStringObject" | ||
| }, | ||
| "Env": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "Entrypoint": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "Cmd": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "Volumes": { | ||
| "$ref": "defs.json#/definitions/mapStringObject" | ||
| }, | ||
| "WorkingDir": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "rootfs": { | ||
| "type": "object", | ||
| "properties": { | ||
| "diff_ids": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "layers": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "history": { | ||
| "type": "object", | ||
| "properties": { | ||
| "created": { | ||
| "type": "string", | ||
| "format": "date-time" | ||
| }, | ||
| "author": { | ||
| "type": "string" | ||
| }, | ||
| "created_by": { | ||
| "type": "string" | ||
| }, | ||
| "comment": { | ||
| "type": "string" | ||
| }, | ||
| "empty_layer": { | ||
| "type": "boolean" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,7 @@ This specification uses the following terms: | |
|
|
||
| Here is an example image JSON file: | ||
|
|
||
| ``` | ||
| ```json,title=Image%20JSON&mediatype=application/vnd.oci.image.serialization.config.v1%2Bjson | ||
| { | ||
| "created": "2015-10-31T22:22:56.015925234Z", | ||
| "author": "Alyssa P. Hacker &[email protected]>", | ||
|
|
||
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:
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.