-
Notifications
You must be signed in to change notification settings - Fork 6
Linking federation backend IDs to the full details of the backend #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think we should implement 1, 3 and 4. I think I'd implement both |
Initially I agreed with you and started to implement that, but realised that then we must/should also change all the vue-components that currently expect a |
listFederation can still be used to populate the federation prop. Why would this be breaking? |
Situation: That doesn't work out. We have to change either the JS client or the Vue components. Or use the Web Editor sitting between the two, it could of course convert back to object form to resolve this. But why convert back and forth. It would be nicer to just pipe it through. Which would be an argument to realise option 2 instead, so that object form is used everywhere. But I understand that from the perspective of the JS client alone, an array is much cleaner when returning a list. So the other idea was to change the Vue components to accept the array form, to save the additional conversion. But that would be a breaking change in the vue-components, as there the federation prop definition is already published as:
One pill must be swallowed, just which one? |
If coming from a spec-compliant backend, `this.data.federation` is an object, so the function used to always return the empty array. The code now transforms the object into an array, and also adds the former object keys to each item as an `id` property.
As discussed earlier, I now implemented it so that the JS client converts it into array form and the Web Editor converts it back. This way each tool can stay true to what makes most sense for itself and the extra work in the Web Editor really is just one line. (Probably I even could've gotten it from somewhere in the desired form already, but those fields may be private and I just found the way through |
I just also implemented the helper functions as I think they are very nice to have. I added I hope the signatures are correct with the IMO, with this, option 4 can be considered solved too, as users can easily pass any string array through those functions now to get all the details they could possibly want. Plus what I wrote up there suggested that the JS client would return arrays of ID strings, but in fact it already returns |
* Fix listFederation, add `id` property (#67 option 1) If coming from a spec-compliant backend, `this.data.federation` is an object, so the function used to always return the empty array. The code now transforms the object into an array, and also adds the former object keys to each item as an `id` property. * Fix docs (closes #68) * Fix JSDoc syntax Thanks automatic tests * Fix listFederation changing raw data see https://github.com/Open-EO/openeo-js-client/pull/69/files#r2036254956 * Add helpers for retrieving backend details (#67 option 3) * Update changelog * Strip "ById", change "undefined" for "null", fix syntax errors * Never return "null" in getFederationBackend(s) see #69 (comment)
As far as I've penetrated this topic so far, I believe the only way to get details about a federation backend out of the client is the
listFederation
method of theCapabilities
class:openeo-js-client/openeo.d.ts
Lines 406 to 411 in 6d0e09b
This gives an array of
FederationBackend
objects, which look like this:openeo-js-client/src/typedefs.js
Lines 198 to 211 in 6d0e09b
This doesn't include their ID. But throughout the rest of the client, the ID is how backends are referenced, e.g.:
openeo-js-client/openeo.d.ts
Lines 657 to 663 in 6d0e09b
openeo-js-client/src/typedefs.js
Lines 45 to 51 in 6d0e09b
So currently it's impossible to link the two, e.g. to meaningfully display the
federation:missing
list to users in the Web Editor.I see
twothreefour options to remedy this:FederationBackend
definition:@property {string} id ID of the back-end.
listFederation
anObject
with the IDs as keys and theFederationBackend
objects as values (or even an explicitMap<string,FederationBackend>
).getBackendDetails(id)
method that you can call with e.g.getBackendDetails("eodc")
and will return the correspondingFederationBackend
object.Which is the best variant? Are there already examples in the client for solving similar situations?
The text was updated successfully, but these errors were encountered: