From 9351fee0d56a69f0161e15655efe0a5b1712ec2e Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 13 Dec 2019 15:06:38 +0100 Subject: [PATCH 1/4] Added load_uploaded_files #83 --- CHANGELOG.md | 1 + load_uploaded_files.json | 65 ++++++++++++++++++++++++++++++++++++++++ tests/openapi.test.js | 4 +++ 3 files changed, 70 insertions(+) create mode 100644 load_uploaded_files.json diff --git a/CHANGELOG.md b/CHANGELOG.md index fe7bd7b9..8e6fa038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `any` - `array_find` - `drop_dimension` + - `load_uploaded_files` - `rename_labels` - Added further examples diff --git a/load_uploaded_files.json b/load_uploaded_files.json new file mode 100644 index 00000000..c5cb0c75 --- /dev/null +++ b/load_uploaded_files.json @@ -0,0 +1,65 @@ +{ + "id": "load_uploaded_files", + "summary": "Load files from the user workspace.", + "description": "Loads user-uploaded files from the local user workspace / data store. The files must have been stored by the authenticated user on the back-end currently connected to.", + "categories": [ + "cubes", + "import" + ], + "parameter_order": [ + "paths", + "format", + "options" + ], + "parameters": { + "paths": { + "description": "The file(s) and folder(s) to read.", + "schema": { + "type": "array", + "subtype": "file-folder-paths", + "items": { + "anyOf": [ + { + "type": "string", + "subtype": "file-path" + }, + { + "type": "string", + "subtype": "folder-path" + } + ] + } + }, + "required": true + }, + "format": { + "description": "The file format to save to. It must be one of the values that the server reports as supported input file formats, which usually correspond to the short GDAL/OGR codes. This parameter is *case insensitive*.", + "schema": { + "type": "string", + "subtype": "input-format" + }, + "required": true + }, + "options": { + "description": "The file format options to be used to read the file(s). Must correspond to the options that the server reports as supported options for the chosen `format`. The option names and valid values usually correspond to the GDAL/OGR format options.", + "schema": { + "type": "object", + "subtype": "input-format-options" + }, + "default": {} + } + }, + "returns": { + "description": "A data cube for further processing.", + "schema": [ + { + "type": "object", + "subtype": "raster-cube" + }, + { + "type": "object", + "subtype": "vector-cube" + } + ] + } +} \ No newline at end of file diff --git a/tests/openapi.test.js b/tests/openapi.test.js index 32322309..dab79bdf 100644 --- a/tests/openapi.test.js +++ b/tests/openapi.test.js @@ -25,8 +25,12 @@ var subtypes = { 'bounding-box': {type: 'object'}, 'collection-id': {type: 'string'}, 'epsg-code': {type: 'integer'}, + 'file-folder-paths': {type: 'array'}, 'file-path': {type: 'string'}, + 'folder-path': {type: 'string'}, 'geojson': {type: 'object'}, + 'input-format': {type: 'string'}, + 'input-format-options': {type: 'object'}, 'job-id': {type: 'string'}, 'kernel': {type: 'array'}, 'output-format': {type: 'string'}, From eaa627f756f0c4c0285f331f651d04903686893d Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 13 Dec 2019 16:12:59 +0100 Subject: [PATCH 2/4] "save to" => "read from" #106 --- load_uploaded_files.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load_uploaded_files.json b/load_uploaded_files.json index c5cb0c75..3a8e9112 100644 --- a/load_uploaded_files.json +++ b/load_uploaded_files.json @@ -33,7 +33,7 @@ "required": true }, "format": { - "description": "The file format to save to. It must be one of the values that the server reports as supported input file formats, which usually correspond to the short GDAL/OGR codes. This parameter is *case insensitive*.", + "description": "The file format to read from. It must be one of the values that the server reports as supported input file formats, which usually correspond to the short GDAL/OGR codes. This parameter is *case insensitive*.", "schema": { "type": "string", "subtype": "input-format" From 3e3fab938be51b38056629912364ef466bb7d2ca Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Tue, 17 Dec 2019 12:06:09 +0100 Subject: [PATCH 3/4] Clarifications for load_uploaded_files --- load_uploaded_files.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/load_uploaded_files.json b/load_uploaded_files.json index 3a8e9112..46a67ca6 100644 --- a/load_uploaded_files.json +++ b/load_uploaded_files.json @@ -1,7 +1,7 @@ { "id": "load_uploaded_files", "summary": "Load files from the user workspace.", - "description": "Loads user-uploaded files from the local user workspace / data store. The files must have been stored by the authenticated user on the back-end currently connected to.", + "description": "Loads one or more user-uploaded files from the local user workspace / data store and returns them as a single data cube. The files must have been stored by the authenticated user on the back-end currently connected to.", "categories": [ "cubes", "import" @@ -13,7 +13,7 @@ ], "parameters": { "paths": { - "description": "The file(s) and folder(s) to read.", + "description": "The files and/or folders to read.\n\nAll files in the specified folders will be read, which includes recursively reading all sub-folders. Implementations may skip files in folders that clearly can't be read using the specified format, but there's no guarantee for it.\n\nAn error is thrown if a file can't be read.", "schema": { "type": "array", "subtype": "file-folder-paths", From b2435911f36a339c07fb22b8ed84aab9e5924d56 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Tue, 17 Dec 2019 16:10:33 +0100 Subject: [PATCH 4/4] Disallow folders #106 --- load_uploaded_files.json | 20 ++++++-------------- tests/openapi.test.js | 3 +-- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/load_uploaded_files.json b/load_uploaded_files.json index 46a67ca6..2061d6e1 100644 --- a/load_uploaded_files.json +++ b/load_uploaded_files.json @@ -13,22 +13,14 @@ ], "parameters": { "paths": { - "description": "The files and/or folders to read.\n\nAll files in the specified folders will be read, which includes recursively reading all sub-folders. Implementations may skip files in folders that clearly can't be read using the specified format, but there's no guarantee for it.\n\nAn error is thrown if a file can't be read.", + "description": "The files to read. Folders can't be specified, instead specify all files. An error is thrown if a file can't be read.", "schema": { "type": "array", - "subtype": "file-folder-paths", + "subtype": "file-paths", "items": { - "anyOf": [ - { - "type": "string", - "subtype": "file-path" - }, - { - "type": "string", - "subtype": "folder-path" - } - ] - } + "type": "string", + "subtype": "file-path" + } }, "required": true }, @@ -41,7 +33,7 @@ "required": true }, "options": { - "description": "The file format options to be used to read the file(s). Must correspond to the options that the server reports as supported options for the chosen `format`. The option names and valid values usually correspond to the GDAL/OGR format options.", + "description": "The file format options to be used to read the files. Must correspond to the options that the server reports as supported options for the chosen `format`. The option names and valid values usually correspond to the GDAL/OGR format options.", "schema": { "type": "object", "subtype": "input-format-options" diff --git a/tests/openapi.test.js b/tests/openapi.test.js index dab79bdf..4559ef6e 100644 --- a/tests/openapi.test.js +++ b/tests/openapi.test.js @@ -25,9 +25,8 @@ var subtypes = { 'bounding-box': {type: 'object'}, 'collection-id': {type: 'string'}, 'epsg-code': {type: 'integer'}, - 'file-folder-paths': {type: 'array'}, + 'file-paths': {type: 'array'}, 'file-path': {type: 'string'}, - 'folder-path': {type: 'string'}, 'geojson': {type: 'object'}, 'input-format': {type: 'string'}, 'input-format-options': {type: 'object'},