Skip to content

Commit

Permalink
feat: Add linz:slug field TDE-1283
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Oct 17, 2024
1 parent 6054f13 commit 4b8d82a
Show file tree
Hide file tree
Showing 3 changed files with 25 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 @@ -70,6 +70,7 @@
"quality:horizontal_accuracy_type": "nominal",
"linz:history": "This is an example dataset lineage description.",
"linz:update_frequency": "P1Y",
"linz:slug": "new-zealand_2015_1m",
"providers": [
{
"name": "Example",
Expand Down
7 changes: 7 additions & 0 deletions extensions/linz/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
"wellington",
"west-coast"
]
},
"linz:slug": {
"type": "string",
"minLength": 1,
"description": "The '<name>-<date>-<GSD>' part of the Open Data Registry path.",
"examples": ["banks-peninsula_2019-2020_0.075m", "new-zealand_2015_1m"]
}
}
},
Expand Down Expand Up @@ -1088,6 +1094,7 @@
"type": "string",
"enum": ["unclassified", "in-confidence", "sensitive", "restricted", "confidential", "secret", "top-secret"]
},
"linz:slug": {},
"linz:update_frequency": {
"type": "string",
"format": "duration"
Expand Down
17 changes: 17 additions & 0 deletions extensions/linz/tests/linz_collection.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,21 @@ o.spec('LINZ collection', () => {
// then
o(valid).equals(true);
});

o("Collection with invalid 'linz:slug' value should fail validation", async () => {
// given
const example = JSON.parse(await fs.readFile(examplePath));
example['linz:slug'] = '';

// when
let valid = validate(example);

// then
o(valid).equals(false);
o(
validate.errors.some(
(error) => error.instancePath === '/linz:slug' && error.message === 'must NOT have fewer than 1 characters',
),
).equals(true)(JSON.stringify(validate.errors));
});
});

0 comments on commit 4b8d82a

Please sign in to comment.