Skip to content

Commit 6aa53ed

Browse files
author
Mrunal Patel
committed
Merge pull request #287 from wking/policy
style: Collect established conventions in a discoverable location
2 parents 6a6ba67 + 408412b commit 6aa53ed

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DOC_FILES := \
44
README.md \
55
code-of-conduct.md \
66
principles.md \
7+
style.md \
78
ROADMAP.md \
89
implementations.md \
910
bundle.md \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Table of Contents
77

88
- [Container Principles](principles.md)
9+
- [Specification Style](style.md)
910
- [Filesystem Bundle](bundle.md)
1011
- Configuration
1112
- [Container Configuration](config.md)

style.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Style and conventions
2+
3+
## Traditionally hex settings should use JSON integers, not JSON strings
4+
5+
For example, [`"classID": 1048577`][class-id] instead of `"classID": "0x100001"`.
6+
The config JSON isn't enough of a UI to be worth jumping through string ↔ integer hoops to support an 0x… form ([source][integer-over-hex]).
7+
8+
## Constant names should keep redundant prefixes
9+
10+
For example, `CAP_KILL` instead of `KILL` in [**`linux.capabilities`**][capabilities]).
11+
The redundancy reduction from removing the namespacing prefix is not useful enough to be worth trimming the upstream identifier ([source][keep-prefix]).
12+
13+
## Optional settings should have pointer Go types
14+
15+
So we have a consistent way to identify unset values ([source][optional-pointer]).
16+
17+
[capabilities]: config-linux.md#capabilities
18+
[class-id]: runtime-config-linux.md#network
19+
[integer-over-hex]: https://github.com/opencontainers/specs/pull/267#discussion_r48360013
20+
[keep-prefix]: https://github.com/opencontainers/specs/pull/159#issuecomment-138728337
21+
[optional-pointer]: https://github.com/opencontainers/specs/pull/233#discussion_r47829711

0 commit comments

Comments
 (0)