Skip to content

Commit d55e6a7

Browse files
committed
Add new schema
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 9f32657 commit d55e6a7

1 file changed

Lines changed: 75 additions & 14 deletions

File tree

schemas/purl-test.schema.json

Lines changed: 75 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,34 @@
6868
}
6969
}
7070
},
71+
"purl_validation_message": {
72+
"title": "PURL validation message",
73+
"description": "Validation severity and message to use as a test expected output when validating a PURL.",
74+
"type": "object",
75+
"additionalProperties": false,
76+
"properties": {
77+
"severity": {
78+
"title": "Validation severity",
79+
"description": "Validation severity.",
80+
"type": "string",
81+
"enum": [
82+
"info",
83+
"warning",
84+
"error"
85+
],
86+
"meta:enum": {
87+
"info": "Informational validation message",
88+
"warning": "Warning validation message",
89+
"error": "Error validation message"
90+
}
91+
},
92+
"message": {
93+
"title": "Validation message",
94+
"description": "Validation message.",
95+
"type": "string"
96+
}
97+
}
98+
},
7199
"purl_test": {
72100
"title": "PURL test",
73101
"description": "A PURL test with input and expected output.",
@@ -128,16 +156,7 @@
128156
"string",
129157
"null"
130158
]
131-
},
132-
"expected_messages": {
133-
"title": "Expected messages",
134-
"description": "Validation messages expected for this test. Can be null or a list of strings.",
135-
"default": null,
136-
"type": ["null", "array"],
137-
"items": {
138-
"type": "string"
139159
}
140-
}
141160
},
142161
"allOf": [
143162
{
@@ -299,9 +318,44 @@
299318
{
300319
"if": {
301320
"properties": {
302-
"test_type": { "const": "validation" }
321+
"test_type": {
322+
"const": "validation"
323+
}
303324
},
304-
"required": ["test_type"]
325+
"required": [
326+
"test_type"
327+
]
328+
},
329+
"then": {
330+
"properties": {
331+
"input": {
332+
"title": "Input test PURL",
333+
"description": "A PURL string to use as a test input (canonical or not).",
334+
"type": "string"
335+
},
336+
"expected_output": {
337+
"title": "Expected validation messages and severities",
338+
"description": "List of validation objects with message and severity expected for this test. Can be an empty list.",
339+
"type": "array",
340+
"$ref": "#/definitions/purl_validation_message"
341+
}
342+
},
343+
"required": [
344+
"input",
345+
"expected_output"
346+
]
347+
}
348+
},
349+
{
350+
"if": {
351+
"properties": {
352+
"test_type": {
353+
"const": "validation"
354+
}
355+
},
356+
"required": [
357+
"test_type"
358+
]
305359
},
306360
"then": {
307361
"properties": {
@@ -314,11 +368,18 @@
314368
"title": "Expected messages",
315369
"description": "Validation messages expected for this test. Can be null or a list of strings.",
316370
"default": null,
317-
"type": ["null", "array"],
318-
"items": { "type": "string" }
371+
"type": [
372+
"null",
373+
"array"
374+
],
375+
"items": {
376+
"type": "string"
377+
}
319378
}
320379
},
321-
"required": ["input"]
380+
"required": [
381+
"input"
382+
]
322383
}
323384
}
324385
]

0 commit comments

Comments
 (0)