File: gojsonschema-pr-750.patch

package info (click to toggle)
golang-github-opencontainers-image-spec 1.0.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, bullseye-backports, bullseye-updates
  • size: 632 kB
  • sloc: makefile: 119
file content (148 lines) | stat: -rw-r--r-- 6,517 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
From 8ee24f6e4c04cb1c18b648276315ff8fd630605d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= <mitr@redhat.com>
Date: Mon, 17 Sep 2018 15:54:34 +0200
Subject: [PATCH 1/2] Fix duplicate "id" values in JSON schema
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The "id" values in JSON schema files must be unique, per RFC draft 8.3.1:
> A schema MAY (and likely will) have multiple URIs, but there is no
> way for a URI to identify more than one schema.
and recent gojsonschema fails when handling such inputs (fairly
nontransparently, it silently fails to resolve $ref references to
absolute URIs and reports something like
> Reference defs.json#/definitions/mapStringString must be canonical
.)

In particular, the https://opencontainers.org/schema/image/descriptor/annotations
id value had three definitions.  To resolve this:
- Leave the definition in image-index-schema.json; although using the /descriptor
  subnamespace for the "manifests" array is a bit surprising, the /image/ part
  clearly belongs to image-index-schema.json
- Rename the id definition in content-descriptor.json, to use the generic
  "blob descriptor" namespace.
- Remove the definition in defs-descriptor.json; that seems to be an "utility"
  schema file describing common structures, but it's better for users to
  reference schema fragments by purpose than by common structure (so that
  we can let the structure diverge in the future if necessary).

Finally, changing the content-descriptor.json "id" value changes the
resolved absolute value of the reference to defs-descriptor.json,
so add another namespace to be handled by fsLoaderFactory.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
---
 schema/content-descriptor.json | 2 +-
 schema/defs-descriptor.json    | 1 -
 schema/schema.go               | 1 +
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/schema/content-descriptor.json b/schema/content-descriptor.json
index 69fcea92..9157e04a 100644
--- a/schema/content-descriptor.json
+++ b/schema/content-descriptor.json
@@ -21,7 +21,7 @@
       "$ref": "defs-descriptor.json#/definitions/urls"
     },
     "annotations": {
-      "id": "https://opencontainers.org/schema/image/descriptor/annotations",
+      "id": "https://opencontainers.org/schema/descriptor/annotations",
       "$ref": "defs-descriptor.json#/definitions/annotations"
     }
   },
diff --git a/schema/defs-descriptor.json b/schema/defs-descriptor.json
index feaea001..dad2b0a3 100644
--- a/schema/defs-descriptor.json
+++ b/schema/defs-descriptor.json
@@ -20,7 +20,6 @@
       }
     },
     "annotations": {
-      "id": "https://opencontainers.org/schema/image/descriptor/annotations",
       "$ref": "defs.json#/definitions/mapStringString"
     }
   }
diff --git a/schema/schema.go b/schema/schema.go
index 2a560552..239eefa2 100644
--- a/schema/schema.go
+++ b/schema/schema.go
@@ -53,6 +53,7 @@ var (
 		"https://opencontainers.org/schema/image/index/",
 		"https://opencontainers.org/schema/image/manifest/",
 		"https://opencontainers.org/schema/image/",
+		"https://opencontainers.org/schema/descriptor/",
 		"https://opencontainers.org/schema/",
 	}
 

From cf56476c82f8dae8b4cd6a28f07f1a627b13d342 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= <mitr@redhat.com>
Date: Mon, 17 Sep 2018 16:01:18 +0200
Subject: [PATCH 2/2] Run (make schema/fs.go) to make the previous commit
 effective
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
---
 schema/fs.go | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/schema/fs.go b/schema/fs.go
index b18f7656..5baeeaec 100644
--- a/schema/fs.go
+++ b/schema/fs.go
@@ -224,32 +224,32 @@ MzuH6GcAAAD//0pj2wvTCgAA
 
 	"/content-descriptor.json": {
 		local:   "content-descriptor.json",
-		size:    1085,
-		modtime: 1515512099,
+		size:    1079,
+		modtime: 1537191585,
 		compressed: `
-H4sIAAAAAAAC/5yTwW7UMBCG73mKUVqpl27NoeIQVb3AnQPcEAevPY6nbGwznlW1oL47mniXJoAo3Vsy
-+r+Zz8n4RwfQe6yOqQjl1A/QfyiY3uUklhIy6BMmgffHUGb4WNBRIGdn4lpbXFYXcbKKR5EyGPNQc9q0
-6k3m0Xi2QTZvbk2rXTSO/AmpgzG5YHKnyXXGWtr4X9MbJ4eCSubtAzpptcK5IAth7QfQgwH0E3qyn1q4
-lf48r0SEOadNIQfQAmNAxuTQw2LGjF8yBuU8hrp5FrvRE18Yj4ESae9qnqfP7FNr0Vf6/pKPRoASbA+C
-9ZVOfxGhJG9v1xKeRqzygobjQ5E8si2RHLiI7mvdT9DYk1ZzuVZdfS1WBDnB1Z3djZlJ4nQ/3OmP9ejv
-r875jkfXlf+ed/Uf9hZ21BQ1CIHzBI+RXASJVI/OMNkDbBF8fky7bD36c+xmk5WbTSnLfDtWiv+77DTZ
-ERcrb5b9zhBc4s2zO7r2jN/2xKhin3+/McttXS9NB/Cle+p+BgAA///HjexwPQQAAA==
+H4sIAAAAAAAC/5yTsW7cMAyGdz8F4QTIkos6BB2MIEu7d2i3ooNOok5Mz5JK8RBci7x7QcvX2G2RILfZ
+xP+Rn2zqVwfQe6yOqQjl1A/QfyqYPuQklhIy6BMmgY9zKDN8LugokLMTca0tLquLOFrFo0gZjHmoOW1a
+9Sbzzni2QTbvbk2rXTSO/AmpgzG5YHKnyXXCWtr4P9MbJ8eCSubtAzpptcK5IAth7QfQgwH0I3qyX1q4
+lf49r0SEKadNIQfQAmNAxuTQw2LGhF8yBuU8hrp5FrvRE18Yj4ESae9qnqdP7FNr0Vf6+ZqPRoASbI+C
+9Y1O/xGhJO9v1xKedljlFQ3HxyJ5x7ZEcuAiuu/1MEJjT1rN5Vp19bVYEeQEV3d2v8tMEsf74U5/rEd/
+f3XOd5xdV/4H3tcX7C3sqSlqEALnER4juQgSqc7OMNojbBF8fkz7bD36c+wmk5WbTSnLdDtWim9fdrPs
+dIbaEm+G3WzZM/44EKMqff37riz3dL0uHcC37qn7HQAA//9DKIMKNwQAAA==
 `,
 	},
 
 	"/defs-descriptor.json": {
 		local:   "defs-descriptor.json",
-		size:    922,
-		modtime: 1515512099,
+		size:    844,
+		modtime: 1537191664,
 		compressed: `
-H4sIAAAAAAAC/6STX2/TMBTF3/spLl7FgDZN4QFp0Ria2DsP42lTV93ZN/Ed8R/ZrqYy9bsjJ1naFYFA
-PCSyj67Pub8b52kCIBRFGdgndlZUIK6oZst5F8FjSCw3LQZIDr56sl+cTciWAlwNx1yAa0+Sa5bYecx7
-09FFVJBzAIQhxfht62mUAASrnKpT8rEqS+fJyueMuHChKaPUZLBkgw2Vakwt927zZ6/Ue4uYAttmr3tM
-iUKHd3d7Wdxg8WNZnK32y1cn09fF3XoxWz0t5+8/fNyVf1c2FV3Erk8SihuK6ZDuaLhJE8iw9ck1Ab1m
-CVKT/B43Bvqz4GrIRe7+gWSaA9tuOwDA6Tm2jQuctLmozvOoFKmL03+cwMA1e/O5up0t1sVqVN6+q/L6
-srhZFmef1sVqdkS4CW38Ax9Cyz1ELoQ6OAOPmqWGpDkOVGBwC/cEyj3a1qEi9Wv/GAJu9zInMoe5vycF
-ELULBvNXEJvAYtB3LzDQWpfw5fX8n7t46Dc2PQ1UZz9FdVw8RGdPyoPfojTor7ve+/cw50l+dpOfAQAA
-//8aH/C2mgMAAA==
+H4sIAAAAAAAC/5SST2/TTBDG7/kU826jt0DiOHBAqlWKKnrnUE6t0mi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