-
Notifications
You must be signed in to change notification settings - Fork 557
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
source and schema: differentiate with examples #276
Conversation
@@ -127,4 +127,77 @@ For Linux-based systems the user structure has the following fields: | |||
Interpretation of the platform section of the JSON file is used to find which platform-specific sections may be available in the document. | |||
For example, if `os` is set to `linux`, then a JSON object conforming to the [Linux-specific schema](config-linux.md) SHOULD be found at the key `linux` in the `config.json`. | |||
|
|||
## Configuration Schema Example | |||
|
|||
Here is a full exmample `config.json` contents for reference (generated with `runc spec`). |
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.
nit: “exmample” → “example”, and I'd drop “contents” and “(generated with runc spec
)”. The generation note may be useful for a commit message, but doesn't seem useful in the spec itself.
On Fri, Dec 18, 2015 at 01:50:31PM -0800, Vincent Batts wrote:
I'm not sure these examples have much normative weight, but they |
+1 for the overall intent of separating schema from the golang structures. |
The only downside is that it makes the Go import path ugly. |
On Fri, Dec 18, 2015 at 02:52:59PM -0800, Michael Crosby wrote:
We expect Go import paths to get more interesting soon anyway, no? |
@vbatts: How do we differentiate between optional and required fields? And how will this address extensible fields? |
On Fri, Dec 18, 2015 at 05:46:21PM -0800, Vish Kannan wrote:
The normative specification will still be things like 1. This is |
@vishh that has to be done per field and value. Like the comments that describe them. * **`path`** (string, required) ...
* **`readonly`** (bool, optional) ...
It's not very parsable, but is legible. |
@crosbymichael you thinking those paths would be ugly was the first thing that came to mind. What do you recommend besides |
otherwise, I've rebased and updated the structs a little based on comments. |
On Mon, Dec 21, 2015 at 12:24:27PM -0800, Vincent Batts wrote:
All the ecccada → 99d1df7 changes look good to me, but this is still |
rebased. PTAL |
On Wed, Jan 13, 2016 at 01:22:20PM -0800, Vincent Batts wrote:
$ diff -u <(git show -M50 99d1df7) <(git show -M50 998344) So that is just “rebased onto the new master to pickup changes in the |
We can do this using ocitools to generate and a Makefile target to update this. |
On Wed, Jan 13, 2016 at 02:43:21PM -0800, Mrunal Patel wrote:
I'm concerned that:
is too long a loop, involving a number of non-normative moving parts. But if the idea is that PR submitters will use whatever tooling they |
rebased |
brainstorming: would the sample json be better served as an |
"CAP_NET_BIND_SERVICE" | ||
], | ||
"apparmorProfile": "", | ||
"selinuxProcessLabel": "" |
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.
Before these moved @mrunalp and I were suggesting we drop the empty values. Since #329 they're omitempty, so I see no reason to keep them in this example.
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.
Its fine to have these in an example because how else would ppl know that they are there without them being in an EXAMPLE
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 Tue, Mar 08, 2016 at 10:43:21AM -0800, Michael Crosby wrote:
"apparmorProfile": "",
"selinuxProcessLabel": ""
Its fine to have these in an example because how else would ppl know
that they are there without them being in an EXAMPLE
I'm fine listing them here with meaningful content. And regardless of
whether they're listed here, I think people should be able to discover
them via the process documentation [1](which seems to use
‘selinuxLabel’ and not ‘selinuxProcessLabel’ anyway).
rebased |
Should we format the json using jq to get a consistent output? |
import "github.com/opencontainers/specs/spec-go" |
@crosbymichael done |
The standard is on the JSON schema (not yet IETF spec JSON-schema), such that it is not implemenations specific. Thus far, the reference has been in how golang source renders the JSON documents. Having the JSON source and the markdown documents in sync has been an ongoing step to keep in sync. Separating these two allows the golang source to continue being _a_ reference, but the JSON schema in the documentation to be _the_ reference. As validation tooling is refined, then it will facilitate ensuring the available golang source conforms to the reference JSON. Signed-off-by: Vincent Batts <[email protected]>
rebased again |
LGTM |
"hooks": { | ||
"prestart": [ | ||
{ | ||
"path": "/", |
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 should be /usr/bin/uptime
args[0] could match that or be something else or just empty.
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.
fixed
Signed-off-by: Vincent Batts <[email protected]>
LGTM |
source and schema: differentiate with examples
The label changed in 5a8a779 (Move process specific settings to process, 2016-03-02, opencontainers#329) and 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276) missed this instance when rebasing around opencontainers#329. Signed-off-by: W. Trevor King <[email protected]>
Also: * Update the link to Go bindings after 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276). * Add a reference to the JSON Schema after cdcabde (schema: JSON Schema and validator for `config.json`, 2016-01-19, opencontainers#313). It's pretty clear that the Go bindings cannot be canonical on their own, because they do not define limits (e.g. the 0 through 512 range for FileMode). The JSON Schema is closer, but still does not cover everything (e.g. "a directory must exist at root.path"). Both the Go bindings and the JSON Schema could grow to cover the full spec by adding that sort of thing to comments and descriptions, but that's not how things seem to be working now. Signed-off-by: W. Trevor King <[email protected]>
Catch up with 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276). Signed-off-by: W. Trevor King <[email protected]>
Also: * Update the link to Go bindings after 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276). * Add a reference to the JSON Schema after cdcabde (schema: JSON Schema and validator for `config.json`, 2016-01-19, opencontainers#313). It's pretty clear that the Go bindings cannot be canonical on their own, because they do not define limits (e.g. the 0 through 512 range for FileMode). The JSON Schema is closer, but still does not cover everything (e.g. "a directory must exist at root.path"). Both the Go bindings and the JSON Schema could grow to cover the full spec by adding that sort of thing to comments and descriptions, but that's not how things seem to be working now. Signed-off-by: W. Trevor King <[email protected]>
Catch up with 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276). Signed-off-by: W. Trevor King <[email protected]>
The label changed in 5a8a779 (Move process specific settings to process, 2016-03-02, opencontainers#329) and 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276) missed this instance when rebasing around opencontainers#329. Signed-off-by: W. Trevor King <[email protected]>
Also: * Update the link to Go bindings after 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276). * Add a reference to the JSON Schema after cdcabde (schema: JSON Schema and validator for `config.json`, 2016-01-19, opencontainers#313). It's pretty clear that the Go bindings cannot be canonical on their own, because they do not define limits (e.g. the 0 through 512 range for FileMode). The JSON Schema is closer, but still does not cover everything (e.g. "a directory must exist at root.path"). Both the Go bindings and the JSON Schema could grow to cover the full spec by adding that sort of thing to comments and descriptions, but that's not how things seem to be working now. Signed-off-by: W. Trevor King <[email protected]>
Catch up with 7bf06d5 (source and schema: differentiate with examples, 2015-12-18, opencontainers#276). Signed-off-by: W. Trevor King <[email protected]>
The standard is on the JSON schema (not yet IETF spec JSON-schema), such
that it is not implemenations specific. Thus far, the reference has been
in how golang source renders the JSON documents.
Having the JSON source and the markdown documents in sync has been an
ongoing step to keep in sync.
Separating these two allows the golang source to continue being a
reference, but the JSON schema in the documentation to be the
reference.
As validation tooling is refined, then it will facilitate ensuring
the available golang source conforms to the reference JSON.