This is happening as part of #2757967: API-first initiative. It's the successor to #2905563: REST: top priorities for Drupal 8.5.x, which was the successor to #2852860: REST: top priorities for Drupal 8.4.x, which was the successor to #2794263: REST: top priorities for Drupal 8.3.x (and #2721489: REST: top priorities for Drupal 8.2.x before that).

Theme: Make Drupal 8’s REST best-in-class.

Any use case (fully decoupled, progressively decoupled, content sync)

  1. Serialization gaps:
  2. File uploads: #1927648: Allow creation of file entities from binary data via REST requests
  3. Full config entity support:
    1. Infrastructure: #2300677: JSON:API POST/PATCH support for fully validatable config entities
      1. #1818574: Support config entities in typed data EntityAdapter
    2. Add validation constraints to all config entity types: #2869792: [meta] Add constraints to all config entity types (dozens of child issues there!)
  4. EntityResource: translations support: #2135829: EntityResource: translations support
    1. Blocker: #2904423: Translated field denormalization creates duplicate values
  5. EntityResource: revisions support: #2946972: EntityResource: revisions support
  6. Term entity type's parent field definition is incomplete: #2977882: Term entity type's "parent" field does not specify "target_bundles" setting: a term from *any* vocabulary can be chosen

DX

  1. #2905563: REST: top priorities for Drupal 8.5.x
  2. Disallowed PATCH access DX: #2938035: When PATCHing a field is disallowed, no reason is given for *why* this happens
    1. Blocker: #2938053: AccessResult::orIf() fails to retain the reason if both operands are neutral or forbidden, but the first contains a reason and the second one does not
  3. Better 406 DX: #2955383: List available representations in 406 responses
    1. Blocker: #2955685: Unrouted URLs cannot have have overridden query or fragments
  4. Date field & Date Range field normalization: #2867206: API-First DX of "date" and "date range" fields: add 'datetime_iso8601' @DataType (de)normalizer using RFC3339 timestamps with timezones
  5. Validation:
    1. #2820364: Entity + Field + Property validation constraints are processed in the incorrect order
    2. #2821077: PATCHing entities validates the entire entity, also unmodified fields, so unmodified fields can throw validation errors
    3. #2847041: Add a format and start/end validation constraints to DateRangeItem to provide helpful REST/JSON:API error message
    4. #2856110: [PP-1] Expose entity validation errors in a machine readable REST API:
  6. 403 instead of 406: #2805279: Routing system + authentication system + format-specific routes (e.g. those in rest.module) = frustrating, unhelpful 403 responses instead of 406 responses
  7. Authentication WTF wrt anon: #2817737: A REST resource's "auth" configuration MUST be non-empty, which prevents configuring it for anon access only

Fully decoupled

Done!

Coherent API-First ecosystem

  1. Use @DataType-level normalizers whenever possible:
    1. Discourage @FieldType-level normalizers: #2926507: Discourage @FieldType-level normalizers, encourage @DataType-level normalizers, to strengthen the API-First ecosystem
      1. Blocker: #2957385: FieldItemNormalizer never calls @DataType-level normalizer service' ::denormalize() method
    2. #2926508: Add DateTimeNormalizer+TimestampNormalizer, deprecate TimestampItemNormalizer: @DataType-level normalizers are reusable by JSON:API
  2. Module-agnostic way to mark entity types as "internal" to exclude them from HTTP APIs like the REST module, https://www.drupal.org/project/jsonapi and https://www.drupal.org/project/graphql: #2941622: Make REST's EntityResource deriver exclude internal entity types and mark ContentModerationState entity type as internal instead of the current hack
    1. #2936714: Entity type definitions cannot be set as 'internal'
      1. #2936725: EntityDataDefinition::create() does not respect derived entity definitions

Velocity+maintainability+reliability+predictability

  1. #2910883: Move all entity type REST tests to the providing modules
  2. #2737751: Refactor REST routing to address its brittleness
    1. #2869426: EntityResource should add _entity_access requirement to REST routes
  3. Deprecations in Serialization/REST respected by all of core:
    1. #2922487: Follow-up for #2910211: fix all deprecation warnings

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

The IS above is identical to #2905563: REST: top priorities for Drupal 8.5.x, just with all completed things removed.

wim leers’s picture

wim leers’s picture

Issue summary: View changes

@gabesullice started the work on a module-agnostic way to mark entity types as "internal" to exclude them from HTTP APIs like the REST module, https://www.drupal.org/project/jsonapi and https://www.drupal.org/project/graphql: #2941622: Make REST's EntityResource deriver exclude internal entity types and mark ContentModerationState entity type as internal instead of the current hack, which was blocked on #2936714: Entity type definitions cannot be set as 'internal' (landed this morning!), which was blocked on #2936725: EntityDataDefinition::create() does not respect derived entity definitions (landed some time ago)!

#2941622: Make REST's EntityResource deriver exclude internal entity types and mark ContentModerationState entity type as internal instead of the current hack is the core REST issue. #2932035: ResourceTypes should be internal when EntityType::isInternal is TRUE is the JSON API issue (which we don't track in this issue).

This is very important for the entire API-First ecosystem, because it means consistency across different HTTP API modules!

wim leers’s picture

Issue summary: View changes

Moving Use @DataType-level normalizers whenever possible + Module-agnostic way to mark entity types as "internal" to exclude them from HTTP APIs like the REST module, https://www.drupal.org/project/jsonapi and https://www.drupal.org/project/graphql to a new Ecosystem bucket.

That makes more sense. None of these things are hard blockers for the REST module, but they do allow REST technical debt to be reduced, and most importantly allow for a coherent API-First ecosystem of modules for Drupal 8.

wim leers’s picture

wim leers’s picture

wim leers’s picture

Issue summary: View changes

Clarifying #9.

wim leers’s picture

wim leers’s picture

wim leers’s picture

wim leers’s picture

See #2300677-242: JSON:API POST/PATCH support for fully validatable config entities — we had a big meeting earlier today at DrupalCon Nashville to ensure that we had consensus between component maintainers and framework managers about how we'd make this a reality, and we did! So this is now in a place where we can iterate very quickly on it from now on :)

wim leers’s picture

Issue summary: View changes

#2449143: REST views specify HTML as a possible request format, so if there is a "regular" HTML view on the same path, it will serve JSON was fixed as part of #2905563: REST: top priorities for Drupal 8.5.x. But that fix revealed that apparently many, many sites were relying on the debug-DX-enhancing behavior of automatically picking the first format for REST export displays of views … meaning that updating to 8.5 (which included #2449143)
broke their site. The long-standing issue #2854543: NegotiationMiddleware calls $request->setRequestFormat('html') when there is no _format request parameter, but shouldn't fixes that, but never gained traction. Until this affected so many 8.5 sites.

So: adding #2854543!

wim leers’s picture

wim leers’s picture

Issue summary: View changes

#2938035: When PATCHing a field is disallowed, no reason is given for *why* this happens landed! A big DX improvement that first existed in https://www.drupal.org/project/jsonapi and now also is available in rest.module 🎉

wim leers’s picture

wim leers’s picture

wim leers’s picture

wim leers’s picture

wim leers’s picture

Status: Active » Fixed

Thanks everybody for helping out here!

We made less progress than I hoped in some areas. But some foundational pieces finally clicked into place. Most importantly, core's rest.module is now in a maintainable state. For the past 4 months, the number of open issues has been below 50, about half of which are feature requests, and a fifth are blocked on other subsystems. And as of Drupal 8.6, each core module that has an HTTP API surface is now responsible for its own test coverage. See https://wimleers.com/blog/api-first-drupal-two-big-maintainability-miles....

Note that of the 14 issues that are tagged with 8.6.0 release notes, of which 2 are for the API-First Initiative, and 22 issues are tagged with 8.6.0 highlights, of which 4 are for the API-First Initiative — or 14% of all release notes issues and 18% of highlights!

Now it's time to move on to 8.7.x. I've opened #3002188: REST: top priorities for Drupal 8.7.x for that, which is the continuation of this issue.

Thanks, and see you around!

(Sister posts at #2905563-48: REST: top priorities for Drupal 8.5.x, #2852860-41: REST: top priorities for Drupal 8.4.x, #2794263-64: REST: top priorities for Drupal 8.3.x and #2721489-48: REST: top priorities for Drupal 8.2.x.)


Let's do a restrospective. We landed:

Any use case
5 issues
DX
3 issues
Coherent API-First ecosystem
3 issues (over half!)
Velocity+maintainability+reliability+predictability
1 issue

Many of them were very difficult to land, requiring lots of consensus building, or requiring blockers to be solved that aren't listed here, often in other subsystems. One of them stood out in particular: file upload support, see https://wimleers.com/blog/api-first-drupal-file-uploads and https://wimleers.com/blog/api-first-drupal-file-uploads-572-comments-sum.... Many of the ones that did not land are already well on their way, making it very likely that they will land in 8.7. In fact, one of them already landed in 8.7: #2922487: Follow-up for #2910211: fix all deprecation warnings!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

wim leers’s picture

I now see I failed to link to https://wimleers.com/blog/api-first-drupal-8.6! 😱