Skip to content

Commit b12752e

Browse files
author
Mrunal Patel
authored
Merge pull request #656 from wking/string-pointer-fixups
schema: Remove string pointers
2 parents 5398f4e + 8320089 commit b12752e

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed

schema/config-linux.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@
179179
"properties": {
180180
"cpus": {
181181
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/cpus",
182-
"$ref": "defs.json#/definitions/stringPointer"
182+
"$ref": "defs.json#/definitions/string"
183183
},
184184
"mems": {
185185
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/mems",
186-
"$ref": "defs.json#/definitions/stringPointer"
186+
"$ref": "defs.json#/definitions/string"
187187
},
188188
"period": {
189189
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/period",
@@ -290,14 +290,8 @@
290290
}
291291
},
292292
"cgroupsPath": {
293-
"oneOf": [
294-
{
295-
"type": "null"
296-
},
297-
{
298-
"type": "string"
299-
}
300-
]
293+
"id": "https://opencontainers.org/schema/bundle/linux/cgroupsPath",
294+
"$ref": "defs.json#/definitions/string"
301295
},
302296
"rootfsPropagation": {
303297
"id": "https://opencontainers.org/schema/bundle/linux/rootfsPropagation",

schema/defs-linux.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
"type": "boolean"
231231
},
232232
"type": {
233-
"$ref": "defs.json#/definitions/stringPointer"
233+
"$ref": "defs.json#/definitions/string"
234234
},
235235
"major": {
236236
"oneOf": [
@@ -253,7 +253,7 @@
253253
]
254254
},
255255
"access": {
256-
"$ref": "defs.json#/definitions/stringPointer"
256+
"$ref": "defs.json#/definitions/string"
257257
}
258258
},
259259
"required": [

schema/defs.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,6 @@
9696
}
9797
]
9898
},
99-
"stringPointer": {
100-
"oneOf": [
101-
{
102-
"type": "string"
103-
},
104-
{
105-
"type": "null"
106-
}
107-
]
108-
},
10999
"mapStringString": {
110100
"type": "object",
111101
"patternProperties": {

style.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ The config JSON isn't enough of a UI to be worth jumping through string <-> inte
1616
For example, `CAP_KILL` instead of `KILL` in [**`linux.capabilities`**][capabilities].
1717
The redundancy reduction from removing the namespacing prefix is not useful enough to be worth trimming the upstream identifier ([source][keep-prefix]).
1818

19-
## Optional settings should have pointer Go types
19+
## Optional settings should not have pointer Go types
2020

21-
So we have a consistent way to identify unset values ([source][optional-pointer]).
22-
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]).
21+
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]).
22+
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.
2323

2424
## Examples
2525

@@ -88,10 +88,10 @@ Following is a fully populated example (not necessarily for copy/paste use)
8888

8989
[capabilities]: config-linux.md#capabilities
9090
[class-id]: config-linux.md#network
91-
[integer-over-hex]: https://github.com/opencontainers/runtime-spec/pull/267#discussion_r48360013
91+
[integer-over-hex]: https://github.com/opencontainers/runtime-spec/pull/267#r48360013
9292
[keep-prefix]: https://github.com/opencontainers/runtime-spec/pull/159#issuecomment-138728337
93-
[no-pointer-for-boolean]: https://github.com/opencontainers/runtime-spec/pull/290#discussion_r50296396
94-
[no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316/files#r50782982
95-
[optional-pointer]: https://github.com/opencontainers/runtime-spec/pull/233#discussion_r47829711
96-
[pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317/files#r50932706
93+
[no-pointer-for-boolean]: https://github.com/opencontainers/runtime-spec/pull/290#r50296396
94+
[no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316#r50782982
95+
[no-pointer-for-strings]: https://github.com/opencontainers/runtime-spec/pull/653#issue-200439192
96+
[pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317#r50932706
9797
[markdown-headers]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#headings

0 commit comments

Comments
 (0)