Problem/Motivation
The default rules of the planner say that every bundle of every content entity type gets a detail endpoint and a listing. On a site with contributed modules installed that is not a reasonable default: it plans an API over orders, payment methods, user profiles, files, path aliases, redirects, the task queue of a search backend, the messages a contact form stored, and every paragraph type of the site - none of which a site would publish, several of which would publish other people's data if the permissions of the endpoints were ever loosened.
Measured on a development site with a typical set of contributed modules: 193 endpoints planned, of which 64 are over paragraph types and roughly 30 over entity types that exist to serve the storage layer rather than the front end. A person reviewing that plan cannot see the twenty endpoints they actually want.
Proposed resolution
- The rules say which entity types they apply to instead of applying to all of them, and the answer is data, the way the rules themselves are.
- An entity type that exists for the storage layer rather than for a reader is not planned: the map already knows which module defines each type and whether the type is internal, and that is more honest than a list of names.
- A paragraph is part of the entity that holds it, not an endpoint of its own - the paragraphs shape renders it inside the response of that entity.
- What a site does publish beyond the default stays a decision it makes: an override or hook_myrest_blueprint_alter() adds back anything the rules leave out, and the plan records that a person asked for it.
- Unit coverage over a fixture map that carries both kinds of entity type.
Remaining tasks
Everything.
Issue fork myrest-3623911
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
Comment #4
sergeydruua commentedComment #6
sergeydruua commented