Problem/Motivation

The engine's core idea is that a field type plus a choice of shape produces a fragment of JSON, and that this mapping is a plugin rather than a branch in a helper. Today the same job is done by thousands of lines of methods on a helper class, four times over across the forks.

Proposed resolution

  • Plugin type MyrestFieldShape with a manager, an interface, a base class and an attribute-based discovery.
  • The interface takes an entity, a field definition and the property settings from the structure, and returns an array fragment plus cache metadata — cacheability travels with the fragment, not around it.
  • Each plugin declares which field types it can serve, so the planner can propose one and reject an impossible pairing.
  • A shape may be asked for a value that is empty; the contract says what it returns then, once, rather than each plugin deciding.
  • Unit and kernel tests for the manager, the base class and the contract.

Remaining tasks

Everything. Every issue that follows in this stage is one plugin against this contract.

Issue fork myrest-3620117

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sergeydruua created an issue. See original summary.

sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)