Problem/Motivation

Currently, the LinkManagers have method names like getRelationUri. However, standardized link relations (such as those in the IANA link relations list) are also acceptable return values. The API should reflect this.

Proposed resolution

Update documentation to specify that the return value does not have to be a URI.

Remaining tasks

  • make a new issue for correcting the @param and @ return types for 8.3.x
Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Update the patch to incorporate feedback from reviews (include an interdiff) Instructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards Instructions

User interface changes

No

API changes

No

Data model changes

No

Comments

clemens.tolboom’s picture

I'm not sure I understand this issue. In #2300979: Hal _links are not conform hal rfc I expected these IANA link relations for HAL.

Is this issue only about code cleanup or also for output JSON and HAL+JSON ?

wim leers’s picture

Status: Active » Needs review
Issue tags: +Documentation
StatusFileSize
new1.23 KB

I think this is saying \Drupal\rest\LinkManager\RelationLinkManagerInterface::getRelationUri() is technically incorrect, it should actually have been \Drupal\rest\LinkManager\RelationLinkManagerInterface::getRelation(), because it doesn't have to be a URI, it can also be something like edit-form or canonical or version-history.

But for that, it's too late. That'd be a BC break. What we can do is updating the existing documentation.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

markdorison’s picture

Version: 8.1.x-dev » 8.3.x-dev
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
markdorison’s picture

Version: 8.3.x-dev » 8.2.x-dev
yesct’s picture

Version: 8.2.x-dev » 8.1.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

I checked https://www.drupal.org/core/d8-allowed-changes#patch
And I think this can still go in 8.1.x since "API documentation improvements" are allowed.

@markdorison Thanks for looking at this issue.

Adding some more information about what you do when you do a review helps the committers and future reviewers.
(https://www.drupal.org/patch/review)

I looked at the patch, also applied in to look at it in more context and noticed:

  1. +++ b/core/modules/rest/src/LinkManager/RelationLinkManagerInterface.php
    @@ -26,7 +26,9 @@
    +   *   The corresponding URI or IANA link relation for the field.
    
    @@ -34,7 +36,7 @@ public function getRelationUri($entity_type, $bundle, $field_name, $context = ar
    +   *   Relation URI (or IANA link relation) to transform into internal IDs.
    

    these two changes can be more consistent with each other (either use the parenthesis or not).

    adding the dot at the end of the sentence is a good standards improvement, cause that line is already being changed by the purpose of this issue.

  2. +++ b/core/modules/rest/src/LinkManager/RelationLinkManagerInterface.php
    @@ -26,7 +26,9 @@
    +   * @see \Drupal\rest\LinkManager\RelationLinkManagerInterface::getRelationUri
        */
       public function getRelationUri($entity_type, $bundle, $field_name, $context = array());
    

    Maybe this @see was supposed to go on the hunk below for the
    \Drupal\rest\LinkManager\RelationLinkManagerInterface::getRelationInternalIds
    (or reference getRelationInternalIds, or maybe reference somewhere else)

    Cause, where the @see is now, it is referencing itself.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rosinegrean’s picture

Assigned: Unassigned » rosinegrean
rosinegrean’s picture

Assigned: rosinegrean » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.07 KB
new1.18 KB

Update the doc with the mentions in #6

wim leers’s picture

Title: Make clear that LinkManager also handles standardized link relations » [PP-1] Make clear that LinkManager also handles standardized link relations
Status: Needs review » Postponed
Related issues: +#2758897: Move rest module's "link manager" services to serialization module, +#2113345: Define a mechanism for custom link relationships

This looks great, thanks! :) But let's postpone this on #2758897: Move rest module's "link manager" services to serialization module (which will move it) and #2113345: Define a mechanism for custom link relationships (which may require this to change).

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

wim leers’s picture

Title: [PP-1] Make clear that LinkManager also handles standardized link relations » Document that HAL's RelationLinkManager(Interface) also supports registered link relation types
Version: 8.3.x-dev » 8.4.x-dev
Component: rest.module » hal.module
Priority: Normal » Minor
Status: Postponed » Reviewed & tested by the community
StatusFileSize
new1.15 KB

#2758897: Move rest module's "link manager" services to serialization module and #2113345: Define a mechanism for custom link relationships have landed since I posted #10. Yay! :)


This interface now lives in the hal module, so changing the component.

  1. Rebased #9
  2. Minor change: changed "IANA link relation" to "IANA link relation type" per #2113345: Define a mechanism for custom link relationships
  3. RTBC'd — thanks! :)

Given that this is clearly a trivial/minor docs-only change, demoting to Minor priority.

  • Gábor Hojtsy committed e375211 on 8.3.x
    Issue #2108243 by Wim Leers, prics, linclark, YesCT: Document that HAL's...

  • Gábor Hojtsy committed c8d1f0b on 8.4.x
    Issue #2108243 by Wim Leers, prics, linclark, YesCT: Document that HAL's...
gábor hojtsy’s picture

Version: 8.4.x-dev » 8.3.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks all, committed to both 8.4.x and 8.3.x given that patch releases allow API docs updates as per https://www.drupal.org/core/d8-allowed-changes#patch.

Status: Fixed » Closed (fixed)

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