Skip to content

Commit 15f9f74

Browse files
wkingxiekeyang
authored andcommitted
descriptor: Require RFC-6838-compliant mediaTypes
Previously we didn't define what a media type was and the old regular expression (from 818a56a, schema: image manifest, 2016-04-12, opencontainers#18) was stricter than the RFC. The RFC rules are in [1], and the JSON Schema regexp syntax is in [2]. In the new pattern, * [A-Za-z0-9] is restricted-name-first (ALPHA / DIGIT), with ALPHA and DIGIT defined in RFC 5234 [3]. * [A-Za-z0-9!#$&-^_.+] is restricted-name-chars. [1]: https://tools.ietf.org/html/rfc6838#section-4.2 [2]: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-3.3 [3]: https://tools.ietf.org/html/rfc5234#appendix-B.1 Signed-off-by: W. Trevor King <[email protected]> Removed the MUST for RFC 6838 from descriptor.md. Signed-off-by: xiekeyang <[email protected]>
1 parent 2eebaf6 commit 15f9f74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

schema/defs-image.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"mediaType": {
55
"id": "https://opencontainers.org/schema/image/mediaType",
66
"type": "string",
7-
"pattern": "^[a-z]+/[0-9a-zA-Z.+]+$"
7+
"pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}$"
88
},
99
"digest": {
1010
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",

0 commit comments

Comments
 (0)