Skip to content

Commit

Permalink
feat: Add new optional linz:event_name collection property
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Dec 4, 2023
1 parent 5184e9b commit f5274c6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions extensions/linz/examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
5 changes: 5 additions & 0 deletions extensions/linz/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
"type"
],
"properties": {
"linz:event_name": {
"type": "string",
"minLength": 1
},
"linz:geographic_description": {
"type": "string",
"minLength": 1
Expand Down Expand Up @@ -1004,6 +1008,7 @@
}
}
},
"linz:event_name": {},
"linz:geographic_description": {},
"linz:geospatial_type": {},
"linz:history": {
Expand Down
31 changes: 31 additions & 0 deletions extensions/linz/tests/linz_collection.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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' &&

Check failure on line 566 in extensions/linz/tests/linz_collection.test.mjs

View workflow job for this annotation

GitHub Actions / test

Delete `⏎·········`
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);
});
});

0 comments on commit f5274c6

Please sign in to comment.