Problem/Motivation
As reported by @bertramakers in #1964034-13: Pass entity_type into Serializer via context we missed some properties for the Drupal\rest\Annotation\RestResource class.
Proposed resolution
Add current properties as available through
$resource->getPluginDefinition()
in \Drupal\rest\RequestHandler::handle

Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 2359245-18.patch | 1.28 KB | wim leers |
| #1 | Screen Shot 2015-01-07 at 15.54.57.png | 295.22 KB | marthinal |
| plugin-definition.png | 33.33 KB | clemens.tolboom |
Comments
Comment #1
marthinal commentedI'm working to create a Rest Resource where anonymous users can register user accounts.
For this resource there's no canonical path and when using Restui module the path is empty.So, can we add for example a "path" to "uri_paths" ?
Attached image with the expected result.
Comment #2
wim leers#1839346: REST module: POST/create and #2019123: Use the same canonical URI paths as for HTML routes should have updated the annotation class, but they did not.
Comment #3
wim leersIn fact, the
deriver(originallyderivative) goes back to when this module was first created (#1816354: Add a REST module, starting with DELETE). When the concept of plugin type-specific annotations was added, it was simply forgotten in #2195571: Add a dedicated @RestResource annotation class.It looks like annotations are not strict enough…
Comment #4
wim leersIn fact:
deriveris something supported by\Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator, it does not belong in the annotation definition apparently. (Messy, but apparently that's the way it is intended.)idandentity_type.Moving to to gather feedback.
Comment #5
wim leersThis part is actually used by
\Drupal\rest\RequestHandler::handle(), so at least this seems to belong on the annotation.Comment #9
wim leersCompletely new patch, #5 didn't apply anymore.
Comment #10
wim leersComment #11
dawehnerShould this default to an empty array?
Comment #12
wim leersThat's probably better, yes.
Do we want this?
No other plugin annotation has this… (as I already pointed out in #4.1).
Comment #13
dawehnerSeems unneeded then. We should that better add to the base class, IMHO.
Comment #14
wim leersDone.
Comment #15
dawehnerNow the documentation ideally should make clear that there are plugin types which don't support deriver
Comment #16
wim leers"if any"
string|nullIsn't this sufficiently clear?
Comment #17
dawehnerWell, the question is, do we want to distinct between the case: Someone hasn't defined a deriver class in their annotation vs. the plugin type don't support them.
Comment #18
wim leersOkay, how about this: we don't deal with
deriverat all here, it's out of scope for the REST module anyway :)Comment #19
dawehnerI 100% agree with that
Comment #21
wim leersRandom fail in
Drupal\Tests\inline_form_errors\FunctionalJavascript\FormErrorHandlerCKEditorTest.Comment #23
wim leersRandom CI infra fail.
Comment #26
gábor hojtsyThe "new" uri_paths key was a bit puzzling to me but I see it is already being used on these resources:
So we are indeed just documenting what we already have. Thanks all!
Comment #27
wim leersIndeed :)
Comment #28
wim leersThis tag is probably also relevant.