Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions schema/content-descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"properties": {
"mediaType": {
"description": "the mediatype of the referenced object",
"$ref": "defs-image.json#definitions/mediaType"
"$ref": "defs-image.json#/definitions/mediaType"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to this. Backing docs in RFC 6901 and the current JSON Schema draft.

},
"size": {
"description": "the size in bytes of the referenced object",
"$ref": "defs.json#/definitions/int64"
},
"digest": {
"$ref": "defs-image.json#definitions/digest"
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with “the digest of the object referenced object”, to match the existing mediaType description. For more details, folks should be reading descriptor.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I carry on the description from https://github.com/opencontainers/image-spec/blob/master/schema/defs-image.json#L10 directly. I think it had better to keep same words for one entry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, fair enough. I can file a PR shooting for consistency between mediaType and digest descriptions if/when this PR lands.

"$ref": "defs-image.json#/definitions/digest"
},
"urls": {
"description": "a list of urls from which this object may be downloaded",
Expand Down
7 changes: 4 additions & 3 deletions schema/defs-image.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"mediaType": {
"id": "https://opencontainers.org/schema/image/mediaType",
"type": "string",
"pattern": "^[a-z]+/[0-9a-zA-Z.+]+$"
"pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}$"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ^ and #` really allowed? What is the source of these additions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should just do an enum here. Is there a way we can define an enum, then have callers of the validator add values to it as needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change is cherry-picked from #448, which focuses on updating the mediaType pattern to match RFC 6838. And yeah, for some reason they allow both # and ^ :p.

I don't think an enum would work, because descriptors are generic. On the other hand, particular instances of descriptors may not be generic, and #404 is an example of using enums in those cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevvooe enum seems too strict, which will lead customized types failed during verifying. I checked RFC 6838, the pattern really follows it. I think RFC 6838 rule should be OK here.

},
"digest": {
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
Expand All @@ -23,14 +23,15 @@
"properties": {
"mediaType": {
"description": "the mediatype of the referenced object",
"$ref": "#definitions/mediaType"
"$ref": "#/definitions/mediaType"
},
"size": {
"description": "the size in bytes of the referenced object",
"$ref": "defs.json#/definitions/int64"
},
"digest": {
"$ref": "#definitions/digest"
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
"$ref": "#/definitions/digest"
},
"urls": {
"description": "a list of urls from which this object may be downloaded",
Expand Down
74 changes: 37 additions & 37 deletions schema/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ var _escData = map[string]*_escFile{
"/config-schema.json": {
local: "config-schema.json",
size: 774,
modtime: 1479372487,
modtime: 1484362154,
compressed: `
H4sIAAAJbogA/5SRsW4DIQyG93sKRDL2QodOt+YBOnSsOlAwOUc6TI0zRFXevQJyTU6KquvCYP/f/2P7
u1NKe8iOMQlS1IPSrwninqJYjMBqTzHgQb0lcBjQ2ap6Ktg2uxEmW5BRJA3GHDPFvlV3xAfj2Qbpn19M
Expand All @@ -218,59 +218,59 @@ YiIJ+f9eV27hNWIW4vOjMSyzPd/WjQLTfejq2Dniyl26+a1/0AxfJ+R68vcHl7htejl9p9RHd+l+AgAA

"/content-descriptor.json": {
local: "content-descriptor.json",
size: 836,
modtime: 1479372487,
size: 956,
modtime: 1484362679,
compressed: `
H4sIAAAJbogA/5SSv+/TMBDF9/wVJ7cjrRkqhqywM8CGGFz7nFzV2OZ8VRVQ/3fkOGlTkL4/lih6ep+7
92z/aQCUw2yZklAMqgX1NWH4HIMYCshQ/jAIfJlNkeFbQkuerJmID2XENtseB1PwXiS1Wp9yDLuq7iN3
2rHxsvt40FXbVI7cguRW65gw2GVznrDq1u6+vXIyJixkPJ7QStUSx4QshFm1UIoBqAEdme/VXKX/+0qP
MPnKUIgeisDokTFYdLDaMeFbRl84hz7vaDAd7kvZjUNPgcrUrB97J+pWYZXp92tJigUowHEUzO9MU3Po
dRAK8unwHMJRh1nWMd7SaKaeJl34nF+oY+BMWUqHYgTPcYBrT7YH6SnPTWAwIxwRXLyGczQO3aPbcsuG
2YwPmQSH9d6VMwtT6O5WAOUjD6a0VRcmNeu3ZvlOVRTjrwsxlsf449+Hs7665xNsAH42t+ZvAAAA//9L
DLQ9RAMAAA==
H4sIAAAJbogA/5STPW/bMBCGd/2KAxMgSxx1CDoIQZZ279BuRQeaPIqXmh89npGqhf97QVGK7bZI4MWw
X7wP7zmZ+t0BKIvFMGWhFNUA6lPG+CFF0RSRoX7DKPBxKSWGzxkNOTJ6Jm7rEdfFeAy64l4kD33/VFLc
tPQu8dhb1k427+77ll01juyKlKHvU8Zo1sllxlq7ty/TGydTxkqm7RMaaVnmlJGFsKgB6mIAKqAl/aWV
W/TvvuIR5l49FJKDGjA6ZIwGLZzMmPFrRlc5i65sKOgR7+qyV71FR5HqsaU/Dp6xQ6NVoV9vqdQKUITt
JFgu1PmPCEV5f38uYWnEIm9oGJ6ypJF19mTAeDTfyz5AY1et5nJbdevPrEWQI9w8eF384/Dg8ae2aCjo
3UI+3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GtB
1+ALdOntQ+Lw6qbj/sbbuG2ZN48eL/OHH1O2rIitzaq7RIp+aGOmEIDjhKhKHZmCDrU54Kap6UtPoC83
a3HG5l+s9u0OLM+6CFVZ9pm6PF8vRrD2xX9b+ycuK4+jcX5m/Uun/tpVfWb5RuFwR4vO+Xu7x/LakWwv
NP6fR5J1/0/sRpjVpZdcoAU5t6NiFNH1b6vT/rmW9mQxVH7UM1PaGiWZ+czOKQh+r0iw6PE8ZTB0l3UZ
/2R+T0lZ6peEngtaxdFNNVe9Y/FW22m0im+UPF6eeFvpPS86KydXu329CM3e4/jL8xwo+qj1ru3kFHzP
XKINZuo8ZM3vmP0OAAD//96B+Ju8CAAA
`,
},

"/defs-image.json": {
local: "defs-image.json",
size: 2736,
modtime: 1481704392,
size: 2916,
modtime: 1484362679,
compressed: `
H4sIAAAJbogA/7yWz27bOBDG736KgRIgB1tWDosFYgQBFpvLnnLInmq4xYQaWZNKpDqkkzqB372gLMv6
m8BN0JMhcvjx+w1nSL9OAIKYrBIuHBsdLCC4pYQ1+y8LBYpjtclQwBm4K0j/a7RD1iTwX45rgvuCFCes
sFw+2+vVAsEC/BYAQU4x4//bguohgIBjv2HqXGEXUWQK0uogb+dG1pFVKeUYsd8qOkrMDgJuLxhYJ6zX
x/ECnSMpcb4uMXxZTaPlZXiF4cs/4Zf5dDU9D8rQ3X5FEPOarGta6yTFpQRKtoUza8EiZQUqJfXdbnLY
rwWTgA8yD4+k3AxYl5+VEbi4TtGmN4vrlH5iTIpzzKqVNxen81yGV9+m83A1XSwxTC7Dqx5RjpoTsu62
4jDygcT3tXqO99zHcaEfGxby+yyrsVYVzI6Dll9a39VhNEaKDF1iJA+qodUxMWIKEsdkG3gj5TZ2rmWs
5zicoVBCQlpRDB2sUuJcKPFrzxqF3ijOOnTXZXzfig/zpfOwdWRPtBNTYueP1uizqGmMtfv7r2FTvaof
x6tCB2U2ktl32BAy3veID4ZETA7PKasUXMq2woIct/BAEJtnnRmMKW6DHkoNRXDbn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WqO61N2xR2N+mr4K1O3IM
9BE1o+y/oQfn66Vk/Saw8Udo0v67+7hAKZXF7pfhwbfaFql/z5Wkq7Dz2mwP+KlLML0uUK97wK10b8fe
PpnFsTeAXk12o3yST34EAAD//zd996RkCwAA
`,
},

"/defs.json": {
local: "defs.json",
size: 3193,
modtime: 1470056192,
modtime: 1484359587,
compressed: `
H4sIAAAJbogA/7SWQZPSMBTH73yKTPSIbpumLXBzRNc97MDMjifHQy0PiEIS09Rx3eG7OymlNG0oFPGw
C03yfv/3/nmheRkghBeQpYpJzQTHE4SnsGScmacM5RkskF4rka/WItdIrwHNJPD3guuEcVDoSULKlixN
Expand All @@ -289,7 +289,7 @@ VfOwZWpT3H45DszfbvA3AAD//0JyEpx5DAAA
"/image-layout-schema.json": {
local: "image-layout-schema.json",
size: 414,
modtime: 1480548955,
modtime: 1484362679,
compressed: `
H4sIAAAJbogA/2yPwUrEMBCG732KIXq0TQVPue5pQdiD4EU8xHa2zWKTOJkKi/TdJZlWD91TmD/z8c3/
UwGoHlNHLrILXhlQp4j+EDxb55HgONkB4dlew8zw0o04WfWQqfskgwE1Mkej9SUFX0vaBBp0T/bMdfuk
Expand All @@ -302,7 +302,7 @@ ngEAAA==
"/image-manifest-schema.json": {
local: "image-manifest-schema.json",
size: 1139,
modtime: 1481704392,
modtime: 1484362154,
compressed: `
H4sIAAAJbogA/6RSsW7bMBDd/RUHJlsjsSk6ae2UoejQoEvRgRVP8gXSkeUxRg3D/16QFCMr7lA0o574
3r137047AGVR+kA+kmPVgfrikT85joYYAzzMZkT4bJgGlAhfPfY0UG/y67tEv5V+j7NJ1H2MvtP6SRw3
Expand All @@ -318,7 +318,7 @@ E6WkmXMEAAA=
"/manifest-list-schema.json": {
local: "manifest-list-schema.json",
size: 1101,
modtime: 1479372487,
modtime: 1484362154,
compressed: `
H4sIAAAJbogA/6ySMY8TMRCF+/yKkY8OsgZEtS00SCAKTjSIwqxns3OKx8bjizid8t+R7fVml1Ag3ZV5
8bz3vZ153AEoizJECok8qx7Ul4D83nMyxBjhozMHhM+GaURJ8IkkwdeAA400mDLyKnu8kGFCZ/L8lFLo
Expand Down
17 changes: 17 additions & 0 deletions schema/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ func TestManifest(t *testing.T) {
fail: true,
},

// expected failure: config.digest is not hex hashed format
{
manifest: `
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"size": 1470,
"digest": "sha256:c86f7763873b6c0aaehhhhhhhhhhhhhhhhmmmmmmmmmmmmmmmm22d9h3bab59b4f"
},
"layers": []
}
`,
fail: true,
},

// valid manifest with optional fields
{
manifest: `
Expand Down
Loading