Multiple fixes for REST, Wiki and JsonAPI storage clients

Created on 13 March 2024, 8 months ago
Updated 7 May 2024, 6 months ago

I don't like to add issues when there is still a long list of unsolved issues but this one offers to solve a couple of them all at once so...

Problem/Motivation

The REST storage client and its derivative suffer from multiple issues. Here is a list of the issue that should be treated by this path/PR:

Steps to reproduce

See each issue case.

Proposed resolution

Remaining tasks

  • have discussions and get something merged

User interface changes

New settings were added to the REST storage client config. The Wiki storage client config has been simplified (and automated). More work to be done on JsonAPI storage client.

API changes

  • ExternalEntityStorageClientBase constructor does not require a ResponseDecoderFactoryInterface parameter anymore.
  • Rest::getListQueryParameters() does not provide paging parameters anymore. These are obtained from a new method: ::getPagingQueryParameters().
  • Rest::countQuery() works differently: it can count results (like before), query the endpoint with a specific URL for counting or use a static value (user-provided)
  • The paging computation is a bit more complex to better handle more use cases.

Data model changes

  • ExternalEntityStorageClientBase constructor does not require a ResponseDecoderFactoryInterface parameter anymore.

New features

  • Provide an optional setting for a different URL from the "list" one to fetch entities that supports an {id} token
  • Provide an optional setting to get the total number of available entities (or provide a static value when the endpoint does not provide a way to get that number)
  • Provide an optional delay between consecutive endpoint queries to partially support endpoint limitations (starting point that needs to be improved in the future)
  • Provide static caching when entities can be fully loaded from the "list" query to avoid unnecessary endpoint queries (to load each external entity individually when listing for instance)
  • Added an optional "data path" settings to support the diversity of REST services and handle each case
  • Improved pager system to support discrepancies between the Drupal-side paging system and the endpoint paging system and restrictions (max number of items per page, indexes starting from 1 instead of 0,...)
  • Improved authentication support: now the API key can be specified either in the header or in the query string but it is specified at one place. There is a basic support for OAuth "Bearer" token (the token still needs to be entered on the admin side but it will be possible to make it support authentication plugins in the future). It is also possible to specify custom authentication headers.
  • Support for additional (custom) HTTP headers in a dedicated section (for instance for accepted server answer format)
  • "{id}" token replacement in single entity query string
  • Simplified Wiki client settings with pre-configured (hidden) settings and improved help/hints
  • Simplified Drupal JSON:API client settings with pre-configured (hidden) settings and improved help/hints
  • Improved performances with the new pager system and the static cache (when possible)
  • A wider range of supported REST API
  • Additional automated tests to test REST client features and default external entity behavior
🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇫🇷France guignonv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024