From 6c92fb6073dac122288ddbff383d868b191393f2 Mon Sep 17 00:00:00 2001 From: cortadocodes Date: Tue, 27 Sep 2022 18:01:07 +0100 Subject: [PATCH] FIX: Update manifest schema --- setup.py | 2 +- tests/test_manifest_strands.py | 66 +++++-------------------- twined/schema/manifest_schema.json | 77 +++++++++++++++--------------- 3 files changed, 52 insertions(+), 93 deletions(-) diff --git a/setup.py b/setup.py index 932cb85..b0183cf 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="twined", - version="0.5.0", + version="0.5.1", py_modules=[], install_requires=["jsonschema ~= 4.4.0", "python-dotenv"], url="https://www.github.com/octue/twined", diff --git a/tests/test_manifest_strands.py b/tests/test_manifest_strands.py index b43da93..fdad67d 100644 --- a/tests/test_manifest_strands.py +++ b/tests/test_manifest_strands.py @@ -121,31 +121,17 @@ def test_valid_manifest_files(self): "files": [ { "path": "configuration/datasets/7ead7669/file_1.csv", - "cluster": 0, - "sequence": 0, - "extension": "csv", "tags": {}, "labels": [], - "posix_timestamp": 0, - "id": "abff07bc-7c19-4ed5-be6d-a6546eae8e86", - "last_modified": "2019-02-28T22:40:30.533005Z", - "name": "file_1.csv", - "size_bytes": 59684813, - "sha-512/256": "somesha" + "timestamp": 0, + "id": "abff07bc-7c19-4ed5-be6d-a6546eae8e86" }, { "path": "configuration/datasets/7ead7669/file_2.csv", - "cluster": 0, - "sequence": 1, - "extension": "csv", "tags": {}, "labels": [], - "posix_timestamp": 0, - "id": "bbff07bc-7c19-4ed5-be6d-a6546eae8e45", - "last_modified": "2019-02-28T22:40:40.633001Z", - "name": "file_2.csv", - "size_bytes": 59684813, - "sha-512/256": "someothersha" + "timestamp": 0, + "id": "bbff07bc-7c19-4ed5-be6d-a6546eae8e45" } ] } @@ -165,31 +151,17 @@ def test_valid_manifest_files(self): "files": [ { "path": "input/datasets/7ead7669/file_1.csv", - "cluster": 0, - "sequence": 0, - "extension": "csv", "tags": {}, "labels": [], - "posix_timestamp": 0, - "id": "abff07bc-7c19-4ed5-be6d-a6546eae8e86", - "last_modified": "2019-02-28T22:40:30.533005Z", - "name": "file_1.csv", - "size_bytes": 59684813, - "sha-512/256": "somesha" + "timestamp": 0, + "id": "abff07bc-7c19-4ed5-be6d-a6546eae8e86" }, { "path": "input/datasets/7ead7669/file_2.csv", - "cluster": 0, - "sequence": 1, - "extension": "csv", "tags": {}, "labels": [], - "posix_timestamp": 0, - "id": "bbff07bc-7c19-4ed5-be6d-a6546eae8e45", - "last_modified": "2019-02-28T22:40:40.633001Z", - "name": "file_2.csv", - "size_bytes": 59684813, - "sha-512/256": "someothersha" + "timestamp": 0, + "id": "bbff07bc-7c19-4ed5-be6d-a6546eae8e45" } ] }, @@ -210,31 +182,17 @@ def test_valid_manifest_files(self): "files": [ { "path": "input/datasets/7ead7669/file_1.csv", - "cluster": 0, - "sequence": 0, - "extension": "csv", "tags": {}, "labels": [], - "posix_timestamp": 0, - "id": "abff07bc-7c19-4ed5-be6d-a6546eae8e86", - "last_modified": "2019-02-28T22:40:30.533005Z", - "name": "file_1.csv", - "size_bytes": 59684813, - "sha-512/256": "somesha" + "timestamp": 0, + "id": "abff07bc-7c19-4ed5-be6d-a6546eae8e86" }, { "path": "input/datasets/7ead7669/file_2.csv", - "cluster": 0, - "sequence": 1, - "extension": "csv", "tags": {}, "labels": [], - "posix_timestamp": 0, - "id": "bbff07bc-7c19-4ed5-be6d-a6546eae8e45", - "last_modified": "2019-02-28T22:40:40.633001Z", - "name": "file_2.csv", - "size_bytes": 59684813, - "sha-512/256": "someothersha" + "timestamp": 0, + "id": "bbff07bc-7c19-4ed5-be6d-a6546eae8e45" } ] } diff --git a/twined/schema/manifest_schema.json b/twined/schema/manifest_schema.json index 57c2a25..abb9870 100644 --- a/twined/schema/manifest_schema.json +++ b/twined/schema/manifest_schema.json @@ -46,47 +46,48 @@ "files": { "type": "array", "items": { - "type": "object", - "properties": { - "id": { - "description": "A file id", - "type": "string" - }, - "path": { - "description": "Path at which the file can be found", - "type": "string" - }, - "extension": { - "description": "The file extension (not including a '.')", - "type": "string" - }, - "sequence": { - "description": "The ordering on the file, if any, within its group/cluster", - "type": [ - "integer", - "null" + "oneOf": [ + { + "type": "object", + "properties": { + "id": { + "description": "A file id", + "type": "string" + }, + "path": { + "description": "Path at which the file can be found", + "type": "string" + }, + "timestamp": { + "oneOf": [ + { + "description": "A posix based timestamp associated with the file. This may, but need not be, the created or modified time. ", + "type": "number" + }, + { + "description": "A posix based timestamp associated with the file. This may, but need not be, the created or modified time. ", + "type": "null" + } + ] + }, + "tags": { + "$ref": "#/$defs/tags" + }, + "labels": { + "$ref": "#/$defs/labels" + } + }, + "required": [ + "id", + "path", + "timestamp", + "tags", + "labels" ] }, - "cluster": { - "description": "The group, or cluster, to which the file belongs", - "type": "integer" - }, - "posix_timestamp": { - "description": "A posix based timestamp associated with the file. This may, but need not be, the created or modified time. ", - "type": "number" - }, - "tags": { - "$ref": "#/$defs/tags" - }, - "labels": { - "$ref": "#/$defs/labels" + { + "type": "string" } - }, - "required": [ - "id", - "path", - "tags", - "labels" ] } }