Open-EO / openeo-api

The openEO API specification
http://api.openeo.org
Apache License 2.0
91 stars 11 forks source link

FileTypeInvalid vs FormatUnsuitable #505

Open soxofaan opened 1 year ago

soxofaan commented 1 year ago

The API defines FileTypeInvalid https://github.com/Open-EO/openeo-api/blob/c5a45b4647b06e313a4f099e9119bfa3cca5c6a3/errors.json#L162-L168

A couple openeo processes however define FormatUnsuitable: load_uploaded_files, load_url, save_result.

I wonder how useful FileTypeInvalid is actually. It's defined in openeo-api, becuase it's part of the file API, but why would certain file extensions or format (which implies inspection of the data) be forbidden in the phase of uploading a file? That seems like a pretty annoying feature of a file API.

If a back-end does not support loading the format at processing time, then it will throw FormatUnsuitable

m-mohr commented 1 year ago

FileTypeInvalid is for the /files endpoints (tag: "File Management"), the others are for specific processes. I assumed some back-ends may want to restrict what users could upload, but maybe they don't? Anyway, it doesn't hurt to have the error, no?

soxofaan commented 1 year ago

back-ends may want to restrict what users could upload, but maybe they don't?

that just seems annoying. And users probably will circumvent it anyway (e.g. append .txt or .json extension just to get something uploaded)

Anyway, it doesn't hurt to have the error, no?

Well, its presence tricked me in using the wrong error code in the validation part of load_url :smile: