Skip to content

Commit

Permalink
feat: Add new linz:region collection property
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Dec 4, 2023
1 parent 960eb2a commit 660eb0f
Show file tree
Hide file tree
Showing 3 changed files with 45 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 @@ -37,6 +37,7 @@
"url": "https://www.exampleurl.com"
}
],
"linz:region": "new-zealand",
"linz:security_classification": "unclassified",
"extent": {
"spatial": {
Expand Down
26 changes: 26 additions & 0 deletions extensions/linz/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
},
Expand Down Expand Up @@ -1043,6 +1068,7 @@
}
}
},
"linz:region": {},
"linz:security_classification": {
"type": "string",
"enum": ["unclassified", "in-confidence", "sensitive", "restricted", "confidential", "secret", "top-secret"]
Expand Down
18 changes: 18 additions & 0 deletions extensions/linz/tests/linz_collection.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
});

0 comments on commit 660eb0f

Please sign in to comment.