From 9a6aca256261a562e3e1afd3ed0a30448b8ef871 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 12 Jan 2017 15:16:08 -0800 Subject: [PATCH 1/3] style: Update GitHub references They've changed their anchor pattern for inline comments. Signed-off-by: W. Trevor King --- style.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/style.md b/style.md index fc501cfc0..b9902d774 100644 --- a/style.md +++ b/style.md @@ -88,10 +88,10 @@ Following is a fully populated example (not necessarily for copy/paste use) [capabilities]: config-linux.md#capabilities [class-id]: config-linux.md#network -[integer-over-hex]: https://github.com/opencontainers/runtime-spec/pull/267#discussion_r48360013 +[integer-over-hex]: https://github.com/opencontainers/runtime-spec/pull/267#r48360013 [keep-prefix]: https://github.com/opencontainers/runtime-spec/pull/159#issuecomment-138728337 -[no-pointer-for-boolean]: https://github.com/opencontainers/runtime-spec/pull/290#discussion_r50296396 -[no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316/files#r50782982 -[optional-pointer]: https://github.com/opencontainers/runtime-spec/pull/233#discussion_r47829711 -[pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317/files#r50932706 +[no-pointer-for-boolean]: https://github.com/opencontainers/runtime-spec/pull/290#r50296396 +[no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316#r50782982 +[optional-pointer]: https://github.com/opencontainers/runtime-spec/pull/233#r47829711 +[pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317#r50932706 [markdown-headers]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#headings From f298e10fd4a9f8bb379353c0729d44d557e7affc Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 12 Jan 2017 15:21:56 -0800 Subject: [PATCH 2/3] style: Reverse pro-pointer preference to be anti-pointer The maintainer position on this has shifted, with the sea change coming around [1]. [1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2017/opencontainers.2017-01-11-22.04.log.html#l-108 Signed-off-by: W. Trevor King --- style.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/style.md b/style.md index b9902d774..bb5bced4f 100644 --- a/style.md +++ b/style.md @@ -16,10 +16,10 @@ The config JSON isn't enough of a UI to be worth jumping through string <-> inte For example, `CAP_KILL` instead of `KILL` in [**`linux.capabilities`**][capabilities]. The redundancy reduction from removing the namespacing prefix is not useful enough to be worth trimming the upstream identifier ([source][keep-prefix]). -## Optional settings should have pointer Go types +## Optional settings should not have pointer Go types -So we have a consistent way to identify unset values ([source][optional-pointer]). -The exceptions are entries where the Go default for the type is a no-op in the spec, in which case `omitempty` is sufficient and no pointer is needed (sources [here][no-pointer-for-slices], [here][no-pointer-for-boolean], and [here][pointer-when-updates-require-changes]). +Because in many cases the Go default for the type is a no-op in the spec (sources [here][no-pointer-for-strings], [here][no-pointer-for-slices], and [here][no-pointer-for-boolean]). +The exceptions are entries where we need to distinguish between “not set” and “set to the Go default for that type” ([source][pointer-when-updates-require-changes]), and this decision should be made on a per-setting case. ## Examples @@ -92,6 +92,6 @@ Following is a fully populated example (not necessarily for copy/paste use) [keep-prefix]: https://github.com/opencontainers/runtime-spec/pull/159#issuecomment-138728337 [no-pointer-for-boolean]: https://github.com/opencontainers/runtime-spec/pull/290#r50296396 [no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316#r50782982 -[optional-pointer]: https://github.com/opencontainers/runtime-spec/pull/233#r47829711 +[no-pointer-for-strings]: https://github.com/opencontainers/runtime-spec/pull/653#issue-200439192 [pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317#r50932706 [markdown-headers]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#headings From 83200898a191343f0ac1ffa7a187b3857c3bca7c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 12 Jan 2017 15:27:56 -0800 Subject: [PATCH 3/3] schema: Remove string pointers Catch up with 868e6310 (Remove string pointers, 2017-01-12, #653). Signed-off-by: W. Trevor King --- schema/config-linux.json | 14 ++++---------- schema/defs-linux.json | 4 ++-- schema/defs.json | 10 ---------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/schema/config-linux.json b/schema/config-linux.json index 0da996aab..ecaba7769 100644 --- a/schema/config-linux.json +++ b/schema/config-linux.json @@ -179,11 +179,11 @@ "properties": { "cpus": { "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/cpus", - "$ref": "defs.json#/definitions/stringPointer" + "$ref": "defs.json#/definitions/string" }, "mems": { "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/mems", - "$ref": "defs.json#/definitions/stringPointer" + "$ref": "defs.json#/definitions/string" }, "period": { "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/period", @@ -290,14 +290,8 @@ } }, "cgroupsPath": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - } - ] + "id": "https://opencontainers.org/schema/bundle/linux/cgroupsPath", + "$ref": "defs.json#/definitions/string" }, "rootfsPropagation": { "id": "https://opencontainers.org/schema/bundle/linux/rootfsPropagation", diff --git a/schema/defs-linux.json b/schema/defs-linux.json index 0cecb14a0..c7b5339f0 100644 --- a/schema/defs-linux.json +++ b/schema/defs-linux.json @@ -230,7 +230,7 @@ "type": "boolean" }, "type": { - "$ref": "defs.json#/definitions/stringPointer" + "$ref": "defs.json#/definitions/string" }, "major": { "oneOf": [ @@ -253,7 +253,7 @@ ] }, "access": { - "$ref": "defs.json#/definitions/stringPointer" + "$ref": "defs.json#/definitions/string" } }, "required": [ diff --git a/schema/defs.json b/schema/defs.json index 89523607d..206e7dd3e 100644 --- a/schema/defs.json +++ b/schema/defs.json @@ -86,16 +86,6 @@ } ] }, - "stringPointer": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, "mapStringString": { "type": "object", "patternProperties": {