Problem/Motivation

The generator plans endpoints from the content model: a detail and a listing per bundle, a tree per vocabulary, a submission per contact form. Five endpoints stay handwritten because they are about the site rather than about a bundle: resolving a path to what it points at, the interface translations, robots.txt, the global variables and the 404 page. The plan was to keep them in the module as they are.

That leaves them outside everything the generated layer gives a site. A site changes a generated endpoint by extending its class in a module of its own: the subclass takes the plugin ID over and survives every regeneration. It cannot do that to these five. A subclass of a handwritten resource under the same plugin ID is not an override but a collision - two handwritten classes claiming one ID - and nothing says which one answers. Yet the path resolver is the endpoint every decoupled front end calls first, and the translations and robots.txt are exactly what sites differ in.

Proposed resolution

  • Move what the five endpoints do into base classes of the module, the way the bundle endpoints already work, and delete the handwritten classes.
  • Plan them on every site, whatever its model, and let the generator write their declarations like any other endpoint - with the same plugin IDs and paths as today, so that a front end notices nothing.
  • Override them the one way every generated endpoint is overridden, and show it in the example of an override.
  • Decide their access. A generated endpoint is closed until its permission is granted; these five are called anonymously by every front end before anything else, so closing them would take a front end off the air after a regeneration. They declare themselves public by nature: reachable with the switch above the whole API alone, as they are today, named in the report of what anybody can call, and closable by an override that declares a permission. Anything they reveal about content still passes the access of that content.
  • Coverage: the five are planned on a site with no bundles at all; their generated declarations answer exactly what the handwritten classes answered; a subclass of the site takes one over; anonymous access without the per-resource permission, and a closing override.

Remaining tasks

Everything.

Issue fork myrest-3624200

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 committed 63629479 on 1.0.x
    Issue #3624200: Generate the site endpoints too, so that every endpoint...
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)