diff --git a/extensions/linz/examples/collection.json b/extensions/linz/examples/collection.json index 0030a389..ff44c167 100644 --- a/extensions/linz/examples/collection.json +++ b/extensions/linz/examples/collection.json @@ -22,6 +22,7 @@ "maximum": "2010-01-01T00:00:00Z" } }, + "linz:event_name": "Forest assessment", "linz:lifecycle": "under development", "linz:geographic_description": "Underhill", "linz:providers": [ diff --git a/extensions/linz/schema.json b/extensions/linz/schema.json index b05d4a69..df92b78f 100644 --- a/extensions/linz/schema.json +++ b/extensions/linz/schema.json @@ -46,6 +46,10 @@ "type" ], "properties": { + "linz:event_name": { + "type": "string", + "minLength": 1 + }, "linz:geographic_description": { "type": "string", "minLength": 1 @@ -1004,6 +1008,7 @@ } } }, + "linz:event_name": {}, "linz:geographic_description": {}, "linz:geospatial_type": {}, "linz:history": { diff --git a/extensions/linz/tests/linz_collection.test.mjs b/extensions/linz/tests/linz_collection.test.mjs index 841a3b56..8989683c 100644 --- a/extensions/linz/tests/linz_collection.test.mjs +++ b/extensions/linz/tests/linz_collection.test.mjs @@ -549,4 +549,35 @@ o.spec('LINZ collection', () => { // then o(valid).equals(true); }); + + o("Collection with invalid 'linz:event_name' value should fail validation", async () => { + // given + const example = JSON.parse(await fs.readFile(examplePath)); + example['linz:event_name'] = ''; + + // when + let valid = validate(example); + + // then + o(valid).equals(false); + o( + validate.errors.some( + (error) => + error.instancePath === '/linz:event_name' && + error.message === 'must NOT have fewer than 1 characters', + ), + ).equals(true)(JSON.stringify(validate.errors)); + }); + + o("Collection with no 'linz:event_name' property should pass validation", async () => { + // given + const example = JSON.parse(await fs.readFile(examplePath)); + delete example['linz:event_name']; + + // when + let valid = validate(example); + + // then + o(valid).equals(true); + }); });