Problem/Motivation

The documentation for the RestResource annotation describes the wrong namespace for a "working example" .

/**
 * Defines a REST resource annotation object.
 *
 * Plugin Namespace: Plugin\rest\resource
 *
 * For a working example, see \Drupal\rest\Plugin\rest\resource\DBLogResource 

Proposed resolution

Either change the namespace to where the DBLogResource resides:
The DBLogResource is not there but in \Drupal\dblog\Plugin\rest\resource\DBLogResource.

or change it to the EntityResource:
The EntityResource does exist at the namespace in the example (\Drupal\rest\Plugin\rest\resource\EntityResource).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thijsvdanker’s picture

Status: Active » Needs review
FileSize
587 bytes

Changed the example in to \Drupal\rest\Plugin\rest\resource\EntityResource as that is part of the same module.

klausi’s picture

Status: Needs review » Needs work

I think we should just mention both classes, since the dblog one is so simple and a good starting point.

rajeevk’s picture

Sorry for jumping in. But had some time to spend, so this is what I did -

  • Kept mention of both classes as per @klausi suggestion.
  • Created patch & attached
  • Created interdiff & attached

Hope it helps..

Status: Needs review » Needs work

The last submitted patch, 3: docs_restresource-2426331-3.patch, failed testing.

The last submitted patch, 3: docs_restresource-2426331-3.patch, failed testing.

cilefen’s picture

@RajeevK Be sure to `git pull` then try the change again.

+++ b/core/modules/rest/src/Annotation/RestResource.php
@@ -15,6 +15,7 @@
  * For a working example, see \Drupal\rest\Plugin\rest\resource\DBLogResource
+ * For a working example, see \Drupal\rest\Plugin\rest\resource\EntityResource

You forgot to remove the line with the wrong documentation.

rajeevk’s picture

Status: Needs work » Needs review
FileSize
667 bytes

Oh..file syntax was changed in the mean time. So had to create new patch from updated code.

Thanks @cilefen

klausi’s picture

Status: Needs review » Needs work
+++ b/core/modules/rest/src/Annotation/RestResource.php
@@ -14,7 +14,8 @@
- * For a working example, see \Drupal\dblog\Plugin\rest\resource\DBLogResource
+ * For a working example, see \Drupal\rest\Plugin\rest\resource\DBLogResource
+ * For a working example, see \Drupal\rest\Plugin\rest\resource\EntityResource

why do you duplicate the string, this can be just "For a working example, see \Drupal\rest\Plugin\rest\resource\DBLogResource or \Drupal\rest\Plugin\rest\resource\EntityResource.

rajeevk’s picture

Status: Needs work » Needs review
FileSize
639 bytes
klausi’s picture

Status: Needs review » Needs work

Comments should wrap at 80 characters, see https://www.drupal.org/coding-standards/docs#drupal

naveenvalecha’s picture

Status: Needs work » Needs review
FileSize
647 bytes
698 bytes
rajeevk’s picture

The last submitted patch, 12: docs_restresource-2426331-12.patch, failed testing.

rajeevk’s picture

Submitting again with correct patch name as per comment number.

klausi’s picture

Status: Needs review » Needs work
+++ b/core/modules/rest/src/Annotation/RestResource.php
@@ -14,7 +14,9 @@
- * For a working example, see \Drupal\dblog\Plugin\rest\resource\DBLogResource
+ * For a working example,
+ * see \Drupal\rest\Plugin\rest\resource\DBLogResource
+ * or \Drupal\rest\Plugin\rest\resource\EntityResource

why do you break the line so early? Shouldn't the "see" be on the line before as it still fits? Same for the "or"?

naveenvalecha’s picture

Status: Needs work » Needs review

Retested #12

klausi’s picture

Status: Needs review » Needs work

my comment from #16 still applies.

rajeevk’s picture

Status: Needs work » Needs review
FileSize
647 bytes
klausi’s picture

Status: Needs review » Needs work
+++ b/core/modules/rest/src/Annotation/RestResource.php
@@ -14,7 +14,9 @@
- * For a working example, see \Drupal\dblog\Plugin\rest\resource\DBLogResource
+ * For a working example, see
+ * \Drupal\rest\Plugin\rest\resource\DBLogResource or
+ * \Drupal\rest\Plugin\rest\resource\EntityResource

The first example still fits on the same line, we don't have to break that early.

joshi.rohit100’s picture

Status: Needs work » Needs review
FileSize
644 bytes
670 bytes
klausi’s picture

Status: Needs review » Closed (duplicate)

This was fixed by #2513264: Fix bad class reference in the meantime.