Open-EO / openeo-api

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

Lists of resources: Arrays vs objects #424

Open soxofaan opened 2 years ago

soxofaan commented 2 years ago

https://github.com/Open-EO/openeo-api/blob/f303d65a3291d4cd74dacc0e796803bb5d6fa03b/openapi.yaml#L727-L779

Billing plans are currently an array of plans, with required name. Does order have a meaning? Otherwise this could be just a mapping/object I guess?

the plan name is used elsewhere (default plan), so has a bit of "id" character. Making it a mapping will make this more explicit.

m-mohr commented 2 years ago

No, there's no meaning assigned. The order might be useful to order them for the UI, but other than that it could be an object indeed. Nevertheless, I don't see a strong reason to change to an object as it would introduce a breaking change for a minor improvement.

soxofaan commented 2 years ago

indeed, it was a suggestion for a breaking (2.x or later) change, to align with other patterns in the API like file formats, udf runtimes, secondary services, ...

m-mohr commented 2 years ago

Actually, during implementation, I found the object approach a bit annoying as the objects are not self-contained (so to pass around all details about a resource the ID has to be added to the object manually). Also, on the top-level it leads to extensibility issues (see recent discussion in the federation extension). The advantage is the uniqueness of the key, but overall in a 2.0 this should be made more consistent (with e.g. collections and processes) and be all arrays, I think.