Skip to content

Field federation:backends in ValidationResult #71

@christophfriedrich

Description

@christophfriedrich

I just pushed a fix (109ac35) because that field got filled incorrectly, but that was just a copy&paste error.

However, I feel there's also a semantic error here: The code ALWAYS fills that field.

IMO that's incorrect: Not only should this field be non-existent for responses from non-federated backends in general, but in the case of federated backends its presence or not actually has a deeper meaning, see https://github.com/Open-EO/openeo-api/blob/draft/extensions/federation/README.md#validation

  • Endpoint returns without errors:
    • federation:backends is included in the response: [...]
    • federation:backends is not included in the response: [...]
  • Endpoint returns errors:
    • federation:backends is included in the response: [...]
    • federation:backends is not included in the response: [...]

But currently, the field is mandatory in a ValidationResult object:

/**
* An array, but enriched with additional details from an openEO API response.
*
* Adds the property `federation:backends`.
*
* @typedef ValidationResult
* @augments Array
* @type {Array.<ApiError>}
* @property {Array.<string>} ["federation:backends"] The back-ends that support / do not support the process.
*/

To fix this, in analogy to e.g.

* @property {?Array.<Link>} links

I'd change line 271 to:

@property {?Array.<string>} ["federation:backends"]

and change the line I fixed in the commit linked above

errors['federation:backends'] = Array.isArray(response.data['federation:backends']) ? response.data['federation:backends'] : [];

to:

if (Array.isArray(response.data['federation:backends']) && response.data['federation:backends'].length > 0) {
	errors['federation:backends'] = response.data['federation:backends'];
}

okay? @m-mohr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions