Skip to content

Commit f475cad

Browse files
authored
Merge pull request #656 from package-url/609-update-standard-md-files
Add, update .md files in /standard #609
2 parents 0e66653 + 7a1d1cc commit f475cad

File tree

4 files changed

+580
-321
lines changed

4 files changed

+580
-321
lines changed

docs/standard/annex-a.md

Lines changed: 0 additions & 318 deletions
Original file line numberDiff line numberDiff line change
@@ -285,321 +285,3 @@ https://github.com/package-url/purl-spec/blob/main/schemas/purl-types-index.sche
285285
10 | }
286286
11 | }
287287
```
288-
289-
## A.3 PURL Tests
290-
291-
The schema shown below is available in electronic form at:
292-
https://github.com/package-url/purl-spec/blob/main/schemas/purl-test.schema.json
293-
294-
```
295-
1 | {
296-
2 | "$schema": "http://json-schema.org/draft-07/schema#",
297-
3 | "$id": "https://packageurl.org/schemas/purl-test.schema-1.0.json",
298-
4 | "title": "PURL test definition",
299-
5 | "description": "Schema for Package-URL building and parsing tests with input and expected output.",
300-
6 | "type": "object",
301-
7 | "additionalProperties": false,
302-
8 | "definitions": {
303-
9 | "purl_components": {
304-
10 | "title": "PURL decoded components",
305-
11 | "description": "Individual decoded PURL components to use as a test input or expected output.",
306-
12 | "type": "object",
307-
13 | "additionalProperties": false,
308-
14 | "properties": {
309-
15 | "type": {
310-
16 | "title": "PURL type",
311-
17 | "description": "Package-URL type component.",
312-
18 | "default": null,
313-
19 | "type": [
314-
20 | "string",
315-
21 | "null"
316-
22 | ]
317-
23 | },
318-
24 | "namespace": {
319-
25 | "title": "PURL namespace",
320-
26 | "description": "Package-URL namespace decoded component.",
321-
27 | "default": null,
322-
28 | "type": [
323-
29 | "string",
324-
30 | "null"
325-
31 | ]
326-
32 | },
327-
33 | "name": {
328-
34 | "title": "PURL name",
329-
35 | "description": "Package-URL name decoded component.",
330-
36 | "default": null,
331-
37 | "type": [
332-
38 | "string",
333-
39 | "null"
334-
40 | ]
335-
41 | },
336-
42 | "version": {
337-
43 | "title": "PURL version",
338-
44 | "description": "Package-URL version decoded component.",
339-
45 | "default": null,
340-
46 | "type": [
341-
47 | "string",
342-
48 | "null"
343-
49 | ]
344-
50 | },
345-
51 | "qualifiers": {
346-
52 | "title": "PURL qualifiers",
347-
53 | "description": "Package-URL qualifiers decoded component as an object.",
348-
54 | "default": null,
349-
55 | "type": [
350-
56 | "object",
351-
57 | "null"
352-
58 | ]
353-
59 | },
354-
60 | "subpath": {
355-
61 | "title": "PURL subpath",
356-
62 | "description": "Package-URL subpath decoded component.",
357-
63 | "default": null,
358-
64 | "type": [
359-
65 | "string",
360-
66 | "null"
361-
67 | ]
362-
68 | }
363-
69 | }
364-
70 | },
365-
71 | "purl_test": {
366-
72 | "title": "PURL test",
367-
73 | "description": "A PURL test with input and expected output.",
368-
74 | "type": "object",
369-
75 | "required": [
370-
76 | "description",
371-
77 | "test_group",
372-
78 | "test_type",
373-
79 | "input"
374-
80 | ],
375-
81 | "properties": {
376-
82 | "description": {
377-
83 | "title": "Test description",
378-
84 | "description": "A description for this test.",
379-
85 | "type": "string"
380-
86 | },
381-
87 | "test_group": {
382-
88 | "title": "Test group",
383-
89 | "description": "The group of this test like 'base' or 'advanced'.",
384-
90 | "type": "string",
385-
91 | "enum": [
386-
92 | "base",
387-
93 | "advanced"
388-
94 | ],
389-
95 | "meta:enum": {
390-
96 | "base": "Test group for base conformance tests for PURL building and parsing.",
391-
97 | "advanced": "Test group for advanced tests to support flexible PURL building and parsing."
392-
98 | }
393-
99 | },
394-
100 | "test_type": {
395-
101 | "title": "Test type",
396-
102 | "description": "The type of this test like 'build' or 'parse'.",
397-
103 | "type": "string",
398-
104 | "enum": [
399-
105 | "build",
400-
106 | "parse",
401-
107 | "roundtrip"
402-
108 | ],
403-
109 | "meta:enum": {
404-
110 | "build": "A PURL building test from decoded components to a canonical PURL string.",
405-
111 | "parse": "A PURL building test from decoded components to a canonical PURL string.",
406-
112 | "roundtrip": "A PURL roundtrip test, parsing then building back a PURL from a canonical string input."
407-
113 | }
408-
114 | },
409-
115 | "expected_failure": {
410-
116 | "title": "Expected failure",
411-
117 | "description": "true if this test input is expected to fail to be processed.",
412-
118 | "type": "boolean",
413-
119 | "default": false
414-
120 | },
415-
121 | "expected_failure_reason": {
416-
122 | "title": "Expected failure reason",
417-
123 | "description": "The reason why this test is is expected to fail if expected_failure is true.",
418-
124 | "default": null,
419-
125 | "type": [
420-
126 | "string",
421-
127 | "null"
422-
128 | ]
423-
129 | }
424-
130 | },
425-
131 | "allOf": [
426-
132 | {
427-
133 | "if": {
428-
134 | "properties": {
429-
135 | "test_type": {
430-
136 | "const": "parse"
431-
137 | },
432-
138 | "expected_failure": {
433-
139 | "const": false
434-
140 | }
435-
141 | },
436-
142 | "required": [
437-
143 | "test_type",
438-
144 | "expected_failure"
439-
145 | ]
440-
146 | },
441-
147 | "then": {
442-
148 | "properties": {
443-
149 | "input": {
444-
150 | "title": "Input test PURL",
445-
151 | "description": "A PURL string to use as a test input (canonical or not).",
446-
152 | "type": "string"
447-
153 | },
448-
154 | "expected_output": {
449-
155 | "title": "Expected output decoded PURL components",
450-
156 | "description": "Test output as an object decoded PURL components, unless expected_failure.",
451-
157 | "$ref": "#/definitions/purl_components"
452-
158 | }
453-
159 | },
454-
160 | "required": [
455-
161 | "input",
456-
162 | "expected_output"
457-
163 | ]
458-
164 | }
459-
165 | },
460-
166 | {
461-
167 | "if": {
462-
168 | "properties": {
463-
169 | "test_type": {
464-
170 | "const": "build"
465-
171 | },
466-
172 | "expected_failure": {
467-
173 | "const": false
468-
174 | }
469-
175 | },
470-
176 | "required": [
471-
177 | "test_type",
472-
178 | "expected_failure"
473-
179 | ]
474-
180 | },
475-
181 | "then": {
476-
182 | "properties": {
477-
183 | "input": {
478-
184 | "title": "Expected output decoded PURL components",
479-
185 | "description": "Test output as an object decoded PURL components, unless expected_failure.",
480-
186 | "$ref": "#/definitions/purl_components"
481-
187 | },
482-
188 | "expected_output": {
483-
189 | "title": "Expected canonical PURL",
484-
190 | "description": "A canonical PURL string to use as a test ouput.",
485-
191 | "type": "string"
486-
192 | }
487-
193 | },
488-
194 | "required": [
489-
195 | "input",
490-
196 | "expected_output"
491-
197 | ]
492-
198 | }
493-
199 | },
494-
200 | {
495-
201 | "if": {
496-
202 | "properties": {
497-
203 | "test_type": {
498-
204 | "const": "roundtrip"
499-
205 | }
500-
206 | },
501-
207 | "required": [
502-
208 | "test_type"
503-
209 | ]
504-
210 | },
505-
211 | "then": {
506-
212 | "properties": {
507-
213 | "input": {
508-
214 | "title": "Input test PURL",
509-
215 | "description": "A PURL string to use as a test input (canonical or not).",
510-
216 | "type": "string"
511-
217 | },
512-
218 | "expected_output": {
513-
219 | "title": "Expected canonical PURL",
514-
220 | "description": "A canonical PURL string to use as a test ouput.",
515-
221 | "type": "string"
516-
222 | }
517-
223 | },
518-
224 | "required": [
519-
225 | "input",
520-
226 | "expected_output"
521-
227 | ]
522-
228 | }
523-
229 | },
524-
230 | {
525-
231 | "if": {
526-
232 | "properties": {
527-
233 | "test_type": {
528-
234 | "const": "parse"
529-
235 | },
530-
236 | "expected_failure": {
531-
237 | "const": true
532-
238 | }
533-
239 | },
534-
240 | "required": [
535-
241 | "test_type",
536-
242 | "expected_failure"
537-
243 | ]
538-
244 | },
539-
245 | "then": {
540-
246 | "properties": {
541-
247 | "input": {
542-
248 | "title": "Input test PURL",
543-
249 | "description": "A PURL string to use as a test input (canonical or not).",
544-
250 | "type": "string"
545-
251 | }
546-
252 | },
547-
253 | "required": [
548-
254 | "input",
549-
255 | "expected_failure_reason"
550-
256 | ]
551-
257 | }
552-
258 | },
553-
259 | {
554-
260 | "if": {
555-
261 | "properties": {
556-
262 | "test_type": {
557-
263 | "const": "build"
558-
264 | },
559-
265 | "expected_failure": {
560-
266 | "const": true
561-
267 | }
562-
268 | },
563-
269 | "required": [
564-
270 | "test_type",
565-
271 | "expected_failure"
566-
272 | ]
567-
273 | },
568-
274 | "then": {
569-
275 | "properties": {
570-
276 | "input": {
571-
277 | "title": "Expected output decoded PURL components",
572-
278 | "description": "Test output as an object decoded PURL components, unless expected_failure.",
573-
279 | "$ref": "#/definitions/purl_components"
574-
280 | }
575-
281 | },
576-
282 | "required": [
577-
283 | "input",
578-
284 | "expected_failure_reason"
579-
285 | ]
580-
286 | }
581-
287 | }
582-
288 | ]
583-
289 | }
584-
290 | },
585-
291 | "properties": {
586-
292 | "$schema": {
587-
293 | "title": "JSON schema",
588-
294 | "description": "Contains the URL of the JSON schema for Package-URL tests.",
589-
295 | "constant": "https://packageurl.org/schemas/purl-test.schema-1.0.json",
590-
296 | "format": "uri"
591-
297 | },
592-
298 | "tests": {
593-
299 | "title": "Test suite",
594-
300 | "description": "A list of Package-URL build and parse tests.",
595-
301 | "additionalItems": false,
596-
302 | "type": "array",
597-
303 | "minItems": 1,
598-
304 | "uniqueItems": true,
599-
305 | "items": {
600-
306 | "$ref": "#/definitions/purl_test"
601-
307 | }
602-
308 | }
603-
309 | }
604-
310 | }
605-
```

0 commit comments

Comments
 (0)