This is happening as part of #2757967: API-first initiative. It's the successor to #3002188: REST: top priorities for Drupal 8.7.x, which was the successor to #2941316: REST: top priorities for Drupal 8.6.x, which was 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: Harden JSON:API and validate the big two future enablers: query builder and hypermedia.

rest.module-specific issues are marked with Ⓡ and jsonapi.module-specific issues with Ⓙ. Issues listed below without any such prefix impact all API-First modules.

If you're interested in helping out with something, come find us in #contenta on Slack.

A note about JSON:API development

Note that for the remainder of the 8.8.x cycle, for JSON:API development the following applies:

  1. Commits must happen against Drupal 8.8.x core first, and are backported to 8.7.x when core policy allows this.
  2. Only commits to 8.7.x may be backported to the https://www.drupal.org/project/jsonapi contrib module (8.x-2.x)
  3. Therefore patches must be filed against the jsonapi.module component in Drupal core. But to speed up development, you can develop the patch in the https://www.drupal.org/project/jsonapi issue queue, since tests run much faster there.

Focus for 8.8

The three API-First Initiative Coordinators @gabesullice, @e0ipso and @Wim Leers will be focusing on these 4 things for 8.8, but we'll still be looking at everything below as well, especially in a review capacity.

  1. Ⓙ Provide interactive documentation/query builder à la GraphiQL in a stable contrib module: https://www.drupal.org/project/jsonapi_explorer. Crucially, this involves improving normalizer infrastructure in Drupal 8.8 that will then be guaranteed to be available in Drupal 9, allowing us to have better HTTP API support in the future without breaking BC. (Ⓙ #2994473: [META] JSON API's normalizers support schema tracking, to guarantee comprehensive schema)
    1. schematic normalizers #3031367: Generate JSON schema for content entity types
    2. deterministic normalizers #3031214: Introduce "deterministic" normalizers
    3. Ⓙ guarantee comprehensive schema, enables powerful tooling #2994473: [META] JSON API's normalizers support schema tracking, to guarantee comprehensive schema
  2. Ⓙ Hypermedia adoption #2994193: [META] The Last Link: A Hypermedia Story (https://www.drupal.org/project/jsonapi_hypermedia is already working sufficiently well, we just want to see more modules adopting it to help validate it further before considering making it part of the JSON:API module itself)
  3. Ⓙ JSON:API core commit follow-up work:
    1. #3040025: [meta] Decide on and implement additional security hardenings for JSON:API and other HTTP APIs
    2. Ⓙ complete revision support #2795279: [PP-2] [META] Revisions support
      1. Ⓙ make "create new revision" optional: #2993557: Allow optional creation of new revision when PATCHing revisionable entities to support autosave functionality via JSON:API.
      2. Ⓙ revision negotiation: support all entity types: #3031271: Support version negotiation for any entity type (currently only Node & Media are supported)
        1. blocker: #3043321: Use generic access API for node and media revision UI
      3. Ⓙ revision discovery: provide version history: #3009588: Provide a collection resource where a version history can be obtained (`version-history`, `predecessor-version` and `successor-version` link relations)
      4. Ⓙ regression: DELETE requests using `self` links made impossible: #3048621: [regression] Resource and relationship object `self` links can no longer be used for update/delete requests.
    3. Ⓙ complete translation support: #2794431: [META] Formalize translations support
  4. Ⓙ JSON:API cacheability/performance improvements for interacting with huge collections and/or highly complex data models
    1. #3039730: Include paths are resolved for every resource in a resource collection, instead of once per unique resource type
    2. #3018287: ResourceTypeRepository computes ResourceType value objects on *every request*
    3. Ⓙ Partial caching for entity normalization, to accelerate collections & includes #2819335: Resource (entity) normalization should use partial caching

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

  1. Ⓙ recommend one or more JS clients that support the widest breadth of functionality Drupal's JSON:API implementation
    1. Ⓙ Exploration: #3047496: Scout existing JavaScript client libraries
    2. Ⓙ Implementation: TBD
  2. Serialization gaps:
  3. #3066202: Filtering multivalue reference fields to contain multiple specified values does not work
  4. Ⓙ Out-of-the-box path aliases in JSON:API: [issue to be created]
  5. Configurable fields cannot be marked internal: #3005924: Follow-up for #2871591: Marking configurable fields as internal is impossible.
  6. POSTed Comment entities should be owned by the currently logged in user: #2975217: Update the default comment entity owner to the current user
  7. Field's "default value" only works in widgets/formatters, not in REST API/JSON API/GraphQL: #3005528: Fields' "default value" functionality only works in formatters and widgets, not at the data level and hence not in HTTP APIs.
  8. "File uploader" service to allow REST/JSON API/GraphQL/… reuse the same file upload/validation logic: #2940383: [META] Unify file upload logic of REST and JSON:API (rather than duplicating, which is very risky)
    1. client-generated IDs for file uploads #3021155: Accept client-generated IDs (UUIDs) for file uploads too
  9. Entity Query Access API #777578: Add an entity query access API and deprecate hook_query_ENTITY_TYPE_access_alter() — would have prevented https://www.drupal.org/sa-contrib-2018-081 (related: #3021930: Follow-up to SA-CONTRIB-2018-081: Restore JSON:API filter access)
  10. Full config entity support:
    1. Infrastructure: #2300677: JSON:API POST/PATCH support for fully validatable config entities
    2. Add validation constraints to all config entity types: #2869792: [meta] Add constraints to all config entity types (dozens of child issues there!)

DX

  1. Ⓙ empty relationship filtering #3025372: [regression] Impossible to filter for resources with an empty relationship object in JSON:API 2.x
  2. Ⓙ Implement upcoming JSON:API 1.1 release:
    1. Ⓙ fancy filters, sorting, pagination and relationship arity: #2955020: Spec Compliance: JSON API's profile/extention (Fancy Filters, Drupal sorting, Drupal pagination, relationship arity) needs to be explicitly communicated
    2. Ⓙ resource versioning profile: #3020136: Author and register a JSON:API profile for resource versioning
  3. Ⓙ JSON:API + maintenance mode #3049048: Invalid JSON:API responses when maintenance mode is on

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

Velocity+maintainability+reliability+predictability

Done!

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Issue summary: View changes

Removing #2856110: [PP-1] Expose entity validation errors in a machine readable REST API: , which is blocked on #1916302: RFC 7807: "Problem Details for HTTP APIs" — serve REST error responses as application/problem+json, because (quoting myself from #1916302-30: RFC 7807: "Problem Details for HTTP APIs" — serve REST error responses as application/problem+json):

FYI: The jsonapi.module effectively already implements this, because the JSON:API spec has absorbed the relevant portions from RFC7807. See https://jsonapi.org/format/#error-objects. Even the language is lifted from RFC7807, for example:

RFC7807
     "title" (string) - A short, human-readable summary of the problem
      type.  It SHOULD NOT change from occurrence to occurrence of the
      problem, except for purposes of localization
JSON:API spec
title: a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.

That doesn't change anything here, but I just wanted to call it out explicitly that this issue applies only to rest.module.

Given that, and the recommendation to use jsonapi.module instead of rest.module for interacting with entities, which is where validation occurs most frequently, I am removing #2856110: [PP-1] Expose entity validation errors in a machine readable REST API: from the top priorities. (It also saw very little interest; the status quo
seems to suffice.)

wim leers’s picture

Issue summary: View changes

I'm marking rest.module-specific issues with Ⓡ and jsonapi.module-specific issues with Ⓙ.

wim leers’s picture

Issue summary: View changes

I triaged the entire JSON:API issue queue once more.

I also took another look at the API-First Initiative Priority Matrix that @gabesullice started (thanks Gabe! 👍) and incorporated much of tha.

This issue summary is meant to evolve: feel free to reorder, add, and remove. As one thing gets blocked, others might move forward. If you're interested in helping out with something, come find us in #contenta on Slack.

There are so many things we would like to see happen. So many foundational improvements that have been holding back rest.module for so long (e.g. full config entity support), have caused countless hours spent on security mitigations for jsonapi.module (e.g. Entity Query Access API), and there are things that would help both (e.g. serialization gaps, better normalizer infrastructure). Besides those foundational problems, there are many features we would like to see added to JSON:API — from more complete revision support to a query builder UI and a full-featured JS client.

I know @gabesullice is going to be working on a PoC for a query builder UI soon, he's already been working on hypermedia support, and we all are already working on performance/cacheability improvements and working to complete revision support.

My focus this quarter (until the end of June) is going to be on Media embedding, so expect less from me. I will probably be back in full capacity in July.

wim leers’s picture

Issue summary: View changes

Note that for the remainder of the 8.8.x cycle, for JSON:API development the following applies:

  1. Commits must happen against Drupal 8.8.x core first, and are backported to 8.7.x when core policy allows this.
  2. Only commits to 8.7.x may be backported to the https://www.drupal.org/project/jsonapi contrib module (8.x-2.x)
  3. Therefore patches must be filed against the jsonapi.module component in Drupal core. But to speed up development, you can develop the patch in the https://www.drupal.org/project/jsonapi issue queue, since tests run much faster there.
wim leers’s picture

Issue summary: View changes

#4 just appended list items to the existing lists.

I just moved them around (without changing any): now they're in the order I think we should tackle them. Looking forward to feedback from my fellow API-First Initiative coordinators @gabesullice and @e0ipso, but also from others of course!

wim leers’s picture

Issue summary: View changes

Adding a few more things from the aforementioned API-First Initiative Priority Matrix that don't yet have issues, yet I think are important for 8.8.

wim leers’s picture

Issue summary: View changes

Adding four missing "Ⓙ"s.

e0ipso’s picture

  1. I'm not 💯 on board with #2825812: ImageItem should have an "derivatives" computed property, to expose all image style URLs. We had that call with Berdir, but I don't think anything new happened yet. I think Consumer Image Styles is a better solution, but I know you don't feel the same.
  2. I didn't know about #3005528: Fields' "default value" functionality only works in formatters and widgets, not at the data level and hence not in HTTP APIs. By the title sounds like something I'm on board with.
  3. We are missing a follow up to #2819335: Resource (entity) normalization should use partial caching about caching links. @gabesullice did you end up creating it?
  4. I'm missing #2994473: [META] JSON API's normalizers support schema tracking, to guarantee comprehensive schema. This is my highest priority and blocks some of the issues listed there.
  5. I see that this is a comprehensive list of all the things. I don't think it's reasonable to expect us to accomplish all those things. Do we want to prioritize & trim?
wim leers’s picture

Issue summary: View changes
  1. It doesn't matter which solution is better: the problem is that Drupal core doesn't provide image styles at all today. This is a basic expectation, having to install two Drupal contrib modules (Consumers + Consumer Image Styles) is perceived as "WTF, Drupal?". I'm happy to do whatever it takes to get something into Drupal 8, even if it's less than complete. Being able to access something is already better than today's nothing :)
  2. This is not new, was already in #3002188: REST: top priorities for Drupal 8.7.x!
  3. I don't know what that's about exactly, but I think what matters most is that the overall priorities are listed and agreed upon; we can always add follow-ups later :)
  4. I actually did not forget about normalizer schema support! It's listed as:
    1. Normalizer infrastructure:
      1. schematic normalizers #3031367: Generate JSON schema for content entity types

    #2994473: [META] JSON API's normalizers support schema tracking, to guarantee comprehensive schema is apparently the meta and should've been listed after "Normalizer infrastructure:" — did that just now, thanks! 🤝

  5. It's actually not comprehensive. It lists all remaining things that we think are especially important, highly impactful. It does not list things we necessarily work on, but also serves as a way to show the community at large which areas we feel we think are important to improve, and in which we'd certainly value more contributions.

    I went through the list and removed #2805279: Routing system + authentication system + format-specific routes (e.g. those in rest.module) = frustrating, unhelpful 403 responses instead of 406 responses, #2817737: A REST resource's "auth" configuration MUST be non-empty, which prevents configuring it for anon access only, #2135829: EntityResource: translations support and #2904423: Translated field denormalization creates duplicate values. Hopefully you agree with those deprioritizations. Which others would you like to remove?

wim leers’s picture

Issue summary: View changes
gabesullice’s picture

Issue summary: View changes

Thanks for putting this together @Wim Leers! This is really helpful.

Here are the changes I've made:

  • We can't recommend a client that supports the full breadth of Drupal's capabilities. None of them do. We can only find the one that supports the widest breadth.
  • I changed the wording about "comprehensive" schema to support a query builder to "enables powerful tooling". A query builder doesn't need details about allowed values, for example. But that would be needed for dynamic form generation.
  • I moved hypermedia support out of "DX" because it's not about DX. It's about supporting application-specific use cases. I set its priority fairly high because it would enable other feature to be more easily experimented with and developed in contrib, like path aliases, decoupled menus and a richer JSON:API explorer tool.

Here are the things I haven't changed, but I think should change:

Overall, I feel that this list is a bit too focused on solving edge cases rather than providing new capabilities. Do you feel that way? Maybe you do, but you think that's ideal or maybe it's just a symptom of the fact that it was derived from existing issues?

wim leers’s picture

Issue summary: View changes

Thanks! I support those changes :)

Overall, I feel that this list is a bit too focused on solving edge cases rather than providing new capabilities. Do you feel that way? Maybe you do, but you think that's ideal or maybe it's just a symptom of the fact that it was derived from existing issues?

The intent has never been to focus on providing new capabilities. The intent is to solve challenges people are encountering in production — whether that's gaps in the existing functionality (which you rightfully describe as "edge cases" — the less edge casey things have been solved by now — but remember that your edge case may be my essential basic case!) or adding new functionality. In the past, there was almost nothing for adding new functionality. The current issue summary is for the first time listing new functionality as the majority actually! 💪

e0ipso’s picture

This is a basic expectation, having to install two Drupal contrib modules (Consumers + Consumer Image Styles) is perceived as "WTF, Drupal?"

I am curious about that expectation and that perception. This is totally normal and expected in other ecosystems like node.js. If you want to expand functionality you install additional dependencies. In node in particular you install 200 npm packages every time :-P

However, I think we need to discuss this point a bit more.


Overall, I feel that this list is a bit too focused on solving edge cases rather than providing new capabilities.

I'm with Gabe here. I think one problem may be that this has been traditionally too core-focused. I am glad to see we are stepping away from that pattern 👏🏽.

About edge cases. I think that the feature spectrum is so sparsely covered that focusing in what we currently do pretty darn well to make it perfect is less important than do more things OK that we are currently not doing at all. We need to focus some more on PoC like jsonapi_hypermedia, decoupled_router, consumer_image_styles, …

I realize that doesn't go against what @Wim Leers is saying, we're probably on the same page (as usual). Just speaking my mind here.


I'm fine with adding OAuth. But that would mean bringing another module into Drupal core, and readying that for core inclusion.

Again, adding it in scope here doesn't necessarily mean core. Right? I'd appreciate it a lot if Simple OAuth got some love from paid & volunteer contributors. Did you know that we have a PoC for OpenID Connect in a patch that is ready to be tested? Maybe that's some stuff we can highlight to get more visibility.

wim leers’s picture

Again, adding it in scope here doesn't necessarily mean core.

That's a very good point. That is what it used to mean. But back then, in #2721489: REST: top priorities for Drupal 8.2.x, API-First Drupal was basically limited to the REST API that Drupal core contained. So I think you're absolutely right that we should change this.

I am curious about that expectation and that perception. This is totally normal and expected in other ecosystems like node.js.

Sure, but A) discoverability is a big problem, B) https://www.drupal.org/project/consumers has fairly far-reaching implications on how the provided HTTP API works: you have to set up consumers, update the API client to send a consumer ID, and so on. I don't think it makes sense that Drupal core's stance would be Oh you don't want to download original image uploads megabytes large and of arbitrary dimensions? Then you must first install these two contrib modules and modify your API client. — that's why I'm saying I think it's a basic expectation. Did that explanation result in you nodding with agreement? If not, I'm ready to give up on this and accept that Drupal core will never be able to provide image styles in its HTTP APIs out of the box.

e0ipso’s picture

A) discoverability is a big problem

So it is in every package manager ever implemented. If anything the centralized nature of d.o makes things much more discoverable instead.

https://www.drupal.org/project/consumers has fairly far-reaching implications on how the provided HTTP API works: you have to set up consumers, update the API client to send a consumer ID, and so on.

That is not accurate ever since two versions ago. Since 1.7 we have default consumers that are created & set up + auto-negotiated without consumer IDs. Hopefully and so on is also solved 😉

If not, I'm ready to give up on this and accept that Drupal core will never be able to provide image styles in its HTTP APIs out of the box.

Honestly, I think that the Consumers module in core would be the first step. It's a well stablished pattern everywhere. However I don't think any of us has the energy for that at the moment.

wim leers’s picture

Issue summary: View changes

I met with my fellow API-First Initiative Coordinators @e0ipso and @gabesullice to discuss this in some more detail and agree on a select few top priorities.

The outcome:

  1. Ⓙ Provide interactive documentation/query builder à la GraphiQL in a stable contrib module: [issue to be created] (work already in progress with https://www.drupal.org/project/jsonapi_schema by @gabesullice and @e0ipso and a query builder UI by @gabesullice and @zrpnr, link to that to follow in next few weeks). Crucially, this involves improving normalizer infrastructure in Drupal 8.8 that will then be guaranteed to be available in Drupal 9, allowing us to have better HTTP API support in the future without breaking BC.
  2. Ⓙ Hypermedia adoption #2994193: [META] The Last Link: A Hypermedia Story (https://www.drupal.org/project/jsonapi_hypermedia is already working sufficiently well, we just want to see more modules adopting it to help validate it further before considering making it part of the JSON:API module itself)
  3. JSON:API core commit follow-up work: #3040025: [meta] Decide on and implement additional security hardenings for JSON:API and other HTTP APIs + complete revision support + complete translation support
  4. JSON:API cacheability/performance improvements for interacting with huge collections and/or highly complex data models

Based on this, I think the theme for this release is Harden JSON:API and validate the big two future enablers: query builder and hypermedia.

Updated issue summary accordingly. More detail there.

wim leers’s picture

To be clear: both the query builder and hypermedia support need must happen in contrib, not in core. But both will likely need improvements in core to reach their full potential (for example schematic normalizers would help the query builder, cacheability associated with links would help hypermedia).

wim leers’s picture

Just talked to @Dries. He’s completely +1 to our 4 top priorities in #17, and agrees with our reasoning. 👍🥳

wim leers’s picture

wim leers’s picture

wim leers’s picture

wim leers’s picture

Issue summary: View changes

I've been triaging the issue queue of the jsonapi.module component in Drupal core. I have good news and bad news.

It seems the majority of bugs being reported against JSON:API are bugs elsewhere in Drupal core. This is actually encouraging, because it means it’s no longer the HTTP API-providing module that gets in the way, it’s the rest of Drupal that actually needs to be thinking of becoming actually API-First. It's also encouraging because it means more people are building more advanced things on top of Drupal core's JSON:API than they were on the REST API.

wim leers’s picture

wim leers’s picture

wim leers’s picture

wim leers’s picture

Issue summary: View changes

With https://www.drupal.org/project/jsonapi_explorer having been released, Ⓙ Provide interactive documentation/query builder à la GraphiQL in a stable contrib module is also definitely completed. But the underlying infrastructure work has not yet been completed, which limits the reliability of the explorer: in case a site is customizing normalizers, it may break. Still, the current version of it is working and already is a huge enabler!

wim leers’s picture

Significant progress was made on #3040025: [meta] Decide on and implement additional security hardenings for JSON:API and other HTTP APIs too, but it's been blocked on framework manager review for nearly 6 months now.

nod_’s picture

Title: API-First Initiative: top priorities for Drupal 8.8.x » API-First Initiative: top priorities

Renaming to be more accurate :)

wim leers’s picture

Shouldn't we just close this since #2757967: API-first initiative has been closed? 🤓

nod_’s picture

Status: Active » Fixed

You'd be the one to know :)

wim leers’s picture

Title: API-First Initiative: top priorities » API-First Initiative: top priorities for Drupal 8.8.x

Hehe 😅

Restoring previous title; it's in line with all preceding sibling issues.

End of an era! 😊

Status: Fixed » Closed (fixed)

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