Closed (fixed)
Project:
Drupal core ideas
Component:
Active Initiative
Priority:
Major
Category:
Plan
Assigned:
Unassigned
Reporter:
Created:
2 Sep 2016 at 12:42 UTC
Updated:
1 Mar 2017 at 14:14 UTC
Jump to comment: Most recent
This is happening as part of #2757967: API-first initiative. It's the successor to #2721489: REST: top priorities for Drupal 8.2.x.
Theme: Make Drupal 8’s REST best-in-class
.
X-CSRF-Token error message distinguish between "missing" and "invalid": #2795965: REST requests with invalid X-CSRF-Token header get "missing " mesageContent-Type request header should have a clear error message: #2811133: Confusing error response set by ContentTypeHeaderMatcher when forgetting the Content-Type request header
Comments
Comment #2
wim leersAs #2757967: API-first initiative already indicated, the goal is .
Comment #3
wim leersFirst, let's start with moving over the uncompleted top priorities from #2721489: REST: top priorities for Drupal 8.2.x. Minus the one thing that can still happen in 8.2: addition of more test coverage: #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method.
This gives us a nice starting point, and shows how much still remains to be done from the (very ambitious) ambitions for 8.2. (Note that of the 34 issues are tagged with , 9 are for REST module!, that's more than 25%.)
Comment #4
wim leersAnd one bit of good news already: #2291055: REST resources for anonymous users: register was ready just barely in time for the 8.2.0 beta. Core committers decided to not commit it to 8.2.x anymore, but it has already been committed to 8.3.x! In other words: we're off to a flying start! :)
Comment #5
dawehnerAdded #2517030: Add a URL formatter for the image field to the issue
Comment #6
wim leers+1 for !
Comment #7
wim leersAdded #2768651: Let TimestampItem (de)normalize to/from RFC3339 timestamps, not UNIX timestamps, for better DX.
Comment #8
wim leersOne very important area where
rest.modulein D8 is lacking today, is dogfooding. Tests are good. And we need more tests, which is why we're working on #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method.But nothing beats dogfooding. (i.e. we build features on top of our own REST API.) For most of Drupal's features, it makes more sense to let PHP code call PHP code. Putting a REST API in between would be silly: lots of layers (PHP -> HTTP request -> PHP, which involves the networking stack, TCP/IP stack, HTTP parsing and generating, etc) that we don't actually need. So, it really only makes sense for Drupal for features that are not written in PHP. We have one of those now: Outside In — #2762505: Introduce "outside in" quick edit pattern to core.
One of the top priorities for REST (also for 8.2.x) was REST API CRUD support for config entities. We did the "R" but we still have to do the C, U and D. Why? Because validation of config entities does not live in the config entity API, but in their forms… which means our REST API can't call the same validation logic. So we first have to fix #2164373: [META] Untie config validation from form validation — enables validatable Recipes, decoupled admin UIs … and #1928868: Typed config incorrectly implements Typed Data interfaces before we can do #2300677: JSON:API POST/PATCH support for fully validatable config entities. Which is why it didn't go anywhere for 8.2.
So, let's make #2300677 the absolute top priority for 8.3. Because dogfooding, but also because it's the most commonly requested and expected capability that we don't have.
Comment #9
wim leersOops. doesn't actually clone an issue.
Comment #10
wim leersI just realized that there is a common thread for 2 of the top priority issues above, and there's a third in the queue: they're all gaps in how serialization works.
(Added that last one.)
Moved that set of three to the second place in the set of priorities, because they undermine the trustworthiness/perceived reliability of our REST API.
Comment #11
wim leersThanks to https://www.previousnext.com.au/blog/we-could-add-default-content-drupal..., I've been made aware of more gaps in our serialization:
Comment #12
wim leersThanks to #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method, I was able to close #2772413: REST GET fails on entity/taxonomy_vocabulary/{id} 403 Forbidden with error, but in doing so the follow-up #2808233: REST 403 responses don't tell the user *why* access is not granted: requires deep Drupal understanding to figure out was filed. That's another very important way to improve DX.
Comment #13
wim leersThanks to #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method I found another DX/RX problem: #2811133: Confusing error response set by ContentTypeHeaderMatcher when forgetting the Content-Type request header.
Comment #14
wim leersAnd another: #2813755: JSON responses encoded inconsistently: make them all RFC4627-compliant.
Comment #15
wim leersAnd another: #2813853: RequestHandler has its own error handling rather than leaving it to KernelEvents::EXCEPTION event subscribers.
Comment #16
e0ipsoThat last one has a mirror issue in JSON API that's being worked on #2810293: [FEATURE] Use exception event for exception response.
Comment #17
wim leersAnd another: #2815845: Importing (deploying) REST resource config entities should automatically do the necessary route rebuilding.
Comment #18
wim leersYay, good news for a change! #2811133: Confusing error response set by ContentTypeHeaderMatcher when forgetting the Content-Type request header landed, and was even backported to 8.2!
Comment #19
wim leersOpened more issues in the past 10 days:
Comment #20
wim leersAnd forgot one: #2820364: Entity + Field + Property validation constraints are processed in the incorrect order.
Comment #21
wim leers#2768651: Let TimestampItem (de)normalize to/from RFC3339 timestamps, not UNIX timestamps, for better DX was just refocused to only deal with
TimestampItem(which lives in core itself), and #2824717: Add a format constraint to DateTimeItem to provide REST error message was filed againstdatetime.moduleto deal withDateTimeItem. Adding that new issue to the IS.Comment #22
wim leers#2517030: Add a URL formatter for the image field was scoped to only REST export displays in Views. #2825487: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field was created to also address the "real"
rest.module-affecting scope.Comment #23
wim leersThat was further split up, so the scope of each issue is more manageable: #2825812: ImageItem should have an "derivatives" computed property, to expose all image style URLs + #2825814: [PP-1] Allow URL query argument to limit the image style URLs returned by ImageItemNormalizer. The latter is a nice-to-have, so only adding the first to the serialization gap top priorities.
Comment #24
wim leers#2795965: REST requests with invalid X-CSRF-Token header get "missing " mesage was created as a follow-up to #2681911: REST requests without X-CSRF-Token header: unhelpful response significantly hinders DX, should receive a 401 response, which was the second DX top priority for REST in 8.2.x. I already got it fixed several weeks ago, but forgot to add it here.
Comment #25
wim leers@tedbow just remarked that entity reference field normalizations have
target_type+target_uuid, but ignore those upon denormalization. That is of course wrong. Opened #2827164: Entity reference field normalization has target_type and target_uuid, but not used in denormalization, as a follow-up to #2060677: Add target_type, target_uuid to serialized output of entity reference fields in non-HAL formats.Comment #26
wim leersAdding all the other relevant issues uncovered by #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method that are sufficiently important but weren't yet listed here.
Most of them belong in the bucket, some of them belong in the bucket, a single one belongs in the bucket and a few belong in a new bucket.
… that means I did not list any of these as top priorities:
Comment #27
wim leers#2807501: ResourceResponse::$responseData is serialized, but is never used: unserializing it on every Page Cache hit is a huge performance penalty landed, yay!
Comment #28
wim leers#2826391: CsrfAccessCheck should have proper error feedback for invalid/missing CSRF token query argument just like CsrfRequestHeaderAccessCheck landed.
Comment #29
wim leersWhile working on #2829327: Review JSON API module for core-readiness because we want to get the JSON API module into core as an experimental module (see #2757967: API-first initiative), I ran into at least one blocker: #2758897: Move rest module's "link manager" services to serialization module.
I think it makes sense to include "JSON API blockers" as top priorities for 8.3 too. So, added a new section for that to the IS, and added that issue as the first one for now.
Comment #30
wim leers#2820888: Cookie authentication: the user.login.http route never supports the 'hal_json' format or some other format, depending on module order landed.
Comment #31
wim leers#2805281: ?_format=hal_json error responses are application/json, yet should be application/hal+json is bad for DX and it turns out to be a JSON API blocker — see #2829977-13: SerializableHttpException and Drupal\jsonapi\Error\* are not necessary.
Comment #32
wim leers#2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method landed!
Unpostponed:
Comment #33
wim leersAdding #2824576: Delete old REST test coverage: (Read|Create|Update|Delete)Test, deprecate RESTTestBase and #2824572: Write EntityResourceTestBase subclasses for every other entity type. to the section.
Comment #34
wim leers#2824576: Delete old REST test coverage: (Read|Create|Update|Delete)Test, deprecate RESTTestBase landed.
Comment #35
wim leersAdded #2835683: Remove HTML from EntityResource validation 422 exception message to the list of DX problems to fix.
Comment #36
wim leers#2813755: JSON responses encoded inconsistently: make them all RFC4627-compliant landed, which unblocked #2739617: Make it easier to write on4xx() exception subscribers :)
Comment #37
wim leers#2739617: Make it easier to write on4xx() exception subscribers blocks #2805281: ?_format=hal_json error responses are application/json, yet should be application/hal+json, also adding that to the top priorities.
Comment #38
wim leers#2739617: Make it easier to write on4xx() exception subscribers landed. This unblocked #2805281: ?_format=hal_json error responses are application/json, yet should be application/hal+json. (Which in turn is blocking #2827084: EntityNormalizer::denormalize should not throw UnexpectedValueException, but \Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException, so we get a 422 response instead of 400.)
Comment #39
gábor hojtsyMoving to ideas queue as an active initiative as per xjm.
Comment #40
e0ipso@Gábor Hojtsy is #2757967: API-first initiative a better match for that intent?
Comment #41
gábor hojtsyWell, this was listed on https://www.drupal.org/core/roadmap as an initiative issue and we just converted it to link to ideas queue issues. If you do not wish to be listed there anymore with this issue, then feel free to move it back to the core queue.
Comment #42
e0ipsoAh! That makes sense then.
Comment #43
wim leersYeah this one is not really a plan that needs to be approved. This is all just work we need to fix the brokenness/gaps in the existing REST API. As such, I don't think it needs framework/product manager sign-off.
The predecessor was #2721489: REST: top priorities for Drupal 8.2.x, which also didn't get (or need) sign-off.
But, at this point, I really don't know anymore. maybe this is the right place? Then #2721489: REST: top priorities for Drupal 8.2.x should also be moved.
Comment #44
gábor hojtsyIf you don't want it listed in the core roadmap, then feel free to move back to the core queue :)
Comment #45
wim leers#2824827: \Drupal\hal\Normalizer\ContentEntityNormalizer::denormalize() fails with fatal PHP error when bundles are missing from link relation types landed!
Comment #46
wim leers#2805281: ?_format=hal_json error responses are application/json, yet should be application/hal+json landed, which unblocked both #2813853: RequestHandler has its own error handling rather than leaving it to KernelEvents::EXCEPTION event subscribers and #2827084: EntityNormalizer::denormalize should not throw UnexpectedValueException, but \Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException, so we get a 422 response instead of 400!
Comment #47
wim leersAdded #2838949: HttpException Handling Does Not Pass Headers to Responses — results e.g. in missing Allow header for 405 responses.
Comment #48
wim leers#2817727: Add test coverage to prove controller is called *after* authentication validation landed.
Comment #49
xjmI think it makes sense to track this in the Ideas queue as an active initiative. It makes these high-priority, ongoing initiatives easier to locate, and of course this initiative has been ongoing since long before release. Thanks @Wim Leers and @Gábor Hojtsy!
Comment #50
wim leersYAY!
Comment #51
wim leersPer #39 and #49, also moved #2721489 to this queue and marked as : #2721489-51: REST: top priorities for Drupal 8.2.x.
Comment #52
wim leers#2820743: FieldNormalizers are very unforgiving, impossible to debug error response given landed!
Comment #53
wim leers#2813853: RequestHandler has its own error handling rather than leaving it to KernelEvents::EXCEPTION event subscribers landed.
Comment #54
wim leers#2838949: HttpException Handling Does Not Pass Headers to Responses — results e.g. in missing Allow header for 405 responses landed!
Comment #55
wim leersAdded #2844046: REST Resource config entities do not respect the status (enabled/disabled).
Comment #56
wim leers#2113345: Define a mechanism for custom link relationships has landed, which is not listed in the IS, but it was a hard blocker for #2293697: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available since August 2016. I rerolled #2293697, and it will hopefully be committed soon, at last!
Comment #57
wim leers#2758897: Move rest module's "link manager" services to serialization module finally landed!
Comment #58
wim leersAdded #2838144: Update "bundle missing" error message in entity denormalization to indicate which field is actually missing.
Comment #59
wim leers#2838144: Update "bundle missing" error message in entity denormalization to indicate which field is actually missing landed!
Comment #60
wim leersForgot to strike through #2835683: Remove HTML from EntityResource validation 422 exception message.
Comment #61
wim leersWOOT, #2808233: REST 403 responses don't tell the user *why* access is not granted: requires deep Drupal understanding to figure out landed! :)
Comment #62
wim leersAnd on the same day, #2815845: Importing (deploying) REST resource config entities should automatically do the necessary route rebuilding landed too! This unblocked #2844046: REST Resource config entities do not respect the status (enabled/disabled), which is also listed as a top priority. Good progress today :)
Comment #63
wim leers#2827084: EntityNormalizer::denormalize should not throw UnexpectedValueException, but \Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException, so we get a 422 response instead of 400 landed! (And apparently that wasn't listed here.)
Comment #64
wim leersThanks everybody for helping out here!
I'm proud of the progress we've made. We've tackled lots of tricky problems.
rest.moduleis in a much better place now! We fixed the majority of things listed here.Note that of the 53 issues are tagged with , 5 are for REST module!, that's almost 10%!
Now it's time to move on to 8.4.x. I've opened #2852860: REST: top priorities for Drupal 8.4.x for that, which is the continuation of this issue.
Thanks, and see you around!
(Sister post at #2721489-48: REST: top priorities for Drupal 8.2.x.)
Let's do a retrospective. We landed:
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. Many of the ones that did not land are already well on their way, making it very likely that they will land in 8.4.
(#2827084 landed already, but only in 8.4, so moved that to the 8.4 top priorities issue.)