diff --git a/extensions/linz/examples/collection.json b/extensions/linz/examples/collection.json index 9611b8df..f6ab2199 100644 --- a/extensions/linz/examples/collection.json +++ b/extensions/linz/examples/collection.json @@ -37,6 +37,7 @@ "url": "https://www.exampleurl.com" } ], + "linz:region": "new-zealand", "linz:security_classification": "unclassified", "extent": { "spatial": { diff --git a/extensions/linz/schema.json b/extensions/linz/schema.json index 9917111d..1341b135 100644 --- a/extensions/linz/schema.json +++ b/extensions/linz/schema.json @@ -76,6 +76,31 @@ "tin", "triangle" ] + }, + "linz:region": { + "type": "string", + "enum": [ + "antarctica", + "auckland", + "bay-of-plenty", + "canterbury", + "gisborne", + "global", + "hawkes-bay", + "manawatu-whanganui", + "marlborough", + "nelson", + "new-zealand", + "northland", + "otago", + "pacific-islands", + "southland", + "taranaki", + "tasman", + "waikato", + "wellington", + "west-coast" + ] } } }, @@ -1043,6 +1068,7 @@ } } }, + "linz:region": {}, "linz:security_classification": { "type": "string", "enum": ["unclassified", "in-confidence", "sensitive", "restricted", "confidential", "secret", "top-secret"] diff --git a/extensions/linz/tests/linz_collection.test.mjs b/extensions/linz/tests/linz_collection.test.mjs index 0faf13b4..edc65ca6 100644 --- a/extensions/linz/tests/linz_collection.test.mjs +++ b/extensions/linz/tests/linz_collection.test.mjs @@ -488,4 +488,22 @@ o.spec('LINZ collection', () => { ), ).equals(true)(JSON.stringify(validate.errors)); }); + + o("Asset with invalid 'linz:region' value should fail validation", async () => { + // given + const example = JSON.parse(await fs.readFile(examplePath)); + example['linz:region'] = ''; + + // when + let valid = validate(example); + + // then + o(valid).equals(false); + o( + validate.errors.some( + (error) => + error.instancePath === '/linz:region' && error.message === 'must be equal to one of the allowed values', + ), + ).equals(true)(JSON.stringify(validate.errors)); + }); });