Skip to content

Commit d78d849

Browse files
author
zhouhao
committed
schema: urls optimization
Signed-off-by: zhouhao <[email protected]>
1 parent 039bc0c commit d78d849

File tree

6 files changed

+10956
-9795
lines changed

6 files changed

+10956
-9795
lines changed

schema/content-descriptor.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,23 @@
66
"properties": {
77
"mediaType": {
88
"description": "the mediatype of the referenced object",
9-
"$ref": "defs-image.json#/definitions/mediaType"
9+
"$ref": "defs-descriptor.json#/definitions/mediaType"
1010
},
1111
"size": {
1212
"description": "the size in bytes of the referenced object",
1313
"$ref": "defs.json#/definitions/int64"
1414
},
1515
"digest": {
1616
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
17-
"$ref": "defs-image.json#/definitions/digest"
17+
"$ref": "defs-descriptor.json#/definitions/digest"
1818
},
1919
"urls": {
2020
"description": "a list of urls from which this object may be downloaded",
21-
"type": "array",
22-
"items": {
23-
"type": "string",
24-
"format": "uri"
25-
}
21+
"$ref": "defs-descriptor.json#/definitions/urls"
2622
},
2723
"annotations": {
2824
"id": "https://opencontainers.org/schema/image/descriptor/annotations",
29-
"$ref": "defs-image.json#/definitions/annotations"
25+
"$ref": "defs-descriptor.json#/definitions/annotations"
3026
}
3127
},
3228
"required": [

schema/defs-descriptor.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"description": "Definitions particular to OpenContainer Descriptor Specification",
3+
"definitions": {
4+
"mediaType": {
5+
"id": "https://opencontainers.org/schema/image/descriptor/mediaType",
6+
"type": "string",
7+
"pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}$"
8+
},
9+
"digest": {
10+
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
11+
"type": "string",
12+
"pattern": "^[a-z0-9_+.-]+:[a-f0-9]+$"
13+
},
14+
"urls": {
15+
"description": "a list of urls from which this object may be downloaded",
16+
"type": "array",
17+
"items": {
18+
"type": "string",
19+
"format": "uri"
20+
}
21+
},
22+
"annotations": {
23+
"id": "https://opencontainers.org/schema/image/descriptor/annotations",
24+
"oneOf": [
25+
{
26+
"$ref": "defs.json#/definitions/mapStringString"
27+
},
28+
{
29+
"type": "null"
30+
}
31+
]
32+
}
33+
}
34+
}

schema/defs-image.json

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
{
22
"description": "Definitions particular to OpenContainer Image Specification",
33
"definitions": {
4-
"mediaType": {
5-
"id": "https://opencontainers.org/schema/image/mediaType",
6-
"type": "string",
7-
"pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}$"
8-
},
9-
"digest": {
10-
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
11-
"type": "string",
12-
"pattern": "^[a-z0-9_+.-]+:[a-f0-9]+$"
13-
},
144
"manifestDescriptor": {
155
"id": "https://opencontainers.org/schema/image/manifestDescriptor",
166
"type": "object",
@@ -22,23 +12,19 @@
2212
"properties": {
2313
"mediaType": {
2414
"description": "the mediatype of the referenced object",
25-
"$ref": "#/definitions/mediaType"
15+
"$ref": "defs-descriptor.json#/definitions/mediaType"
2616
},
2717
"size": {
2818
"description": "the size in bytes of the referenced object",
2919
"$ref": "defs.json#/definitions/int64"
3020
},
3121
"digest": {
3222
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
33-
"$ref": "#/definitions/digest"
23+
"$ref": "defs-descriptor.json#/definitions/digest"
3424
},
3525
"urls": {
3626
"description": "a list of urls from which this object may be downloaded",
37-
"type": "array",
38-
"items": {
39-
"type": "string",
40-
"format": "uri"
41-
}
27+
"$ref": "defs-descriptor.json#/definitions/urls"
4228
},
4329
"platform": {
4430
"id": "https://opencontainers.org/schema/image/platform",
@@ -80,13 +66,9 @@
8066
},
8167
"annotations": {
8268
"id": "https://opencontainers.org/schema/image/descriptor/annotations",
83-
"$ref": "#/definitions/annotations"
69+
"$ref": "defs-descriptor.json#/definitions/annotations"
8470
}
8571
}
86-
},
87-
"annotations": {
88-
"id": "https://opencontainers.org/schema/image/annotations",
89-
"$ref": "defs.json#/definitions/mapStringString"
9072
}
9173
}
9274
}

0 commit comments

Comments
 (0)