Part of #1966246: [meta] Introduce specific annotations for each plugin type.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because it is part of a meta-issue that is itself a task.
Issue priority Normal because it replaces working code with better/consistent code.
Prioritized changes Prioritized at maintainer discretion (@xjm and @alexpott) per the meta issue: #1966246: [meta] Introduce specific annotations for each plugin type
Disruption Minor BC break for modules implementing these plugins.

Comments

les lim’s picture

Status: Active » Needs review
StatusFileSize
new11 KB

Status: Needs review » Needs work

The last submitted patch, 1: core-2195083-constraint-annotation.patch, failed testing.

The last submitted patch, 1: core-2195083-constraint-annotation.patch, failed testing.

les lim’s picture

Status: Needs work » Needs review
StatusFileSize
new12.02 KB
new1.02 KB

Added the annotation class to the plugin manager.

pfrenssen’s picture

pwolanin’s picture

Hmm, so we don't need a use for the annotation class?

pwolanin’s picture

Status: Needs review » Needs work

The annotation class has + public $types;

The annotations themselves have type

dawehner’s picture

Hmm, so we don't need a use for the annotation class?

No you don't, we have some magic to load these automatically.

larowlan’s picture

Issue tags: +Needs re-roll
gbisht’s picture

Issue tags: +dcdelhi
yesct’s picture

Issue tags: -Needs re-roll +Needs reroll

actual tag has no dash.

jain_deepak’s picture

Status: Needs work » Needs review
StatusFileSize
new990 bytes

Rerolled

Status: Needs review » Needs work

The last submitted patch, 12: interdiff-2195083-1-12.patch, failed testing.

gaurav_varshney’s picture

i am working on that issue

ravi.khetri’s picture

Status: Needs work » Needs review
Issue tags: +SprintWeekend2015
StatusFileSize
new3.64 KB

Status: Needs review » Needs work

The last submitted patch, 15: 2195083_15.patch, failed testing.

gaurav_varshney’s picture

StatusFileSize
new11.14 KB

Rerolled Patch

ravi.khetri’s picture

Status: Needs work » Needs review
StatusFileSize
new5.05 KB

Status: Needs review » Needs work

The last submitted patch, 18: 2195083_18.patch, failed testing.

gaurav_varshney’s picture

StatusFileSize
new11.14 KB

Change Comment Number

gaurav_varshney’s picture

Status: Needs work » Needs review

The last submitted patch, 17: core-2195083-15-constraint-annotation.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 20: core-2195083-20-constraint-annotation.patch, failed testing.

luismagr’s picture

Assigned: Unassigned » luismagr
luismagr’s picture

Assigned: luismagr » Unassigned
Issue tags: -Needs reroll
yesct’s picture

patch in #4 was 12k bytes.
patch in #12 was 909 bytes. Seems like the rerolls here have done something not correct.

Also #20 looks to be the same as #17... you dont need to post a patch again to retest a previous patch, just use the retest link.
And if you think a previous patch was wrong, please add a comment saying why.

It would really help if when posting a reroll if people who say which patch they were rerolling. was everyone trying to reroll #4?

Also, was anyone able to install drupal after their reroll locally?

View the testbot results,
seems the error is
Recoverable fatal error: Argument 3 passed to Drupal\Core\Plugin\DefaultPluginManager::__construct() must implement interface Drupal\Core\Extension\ModuleHandlerInterface, string given, called in /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Validation/ConstraintManager.php on line 48 and defined in Drupal\Core\Plugin\DefaultPluginManager->__construct() (line 99 of /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php).

fago’s picture

Issue tags: +Entity validation

yes, this moves over some docs but needs to remove previous docs.

fago’s picture

Status: Needs work » Needs review
StatusFileSize
new14.63 KB
new5.54 KB

ok, re-rolled the patch and fixed some errors:
- Constraint class: it's 'type' not types and fixed its docs
- removed referenced to not existing hook docs for altering
- added pointer to the constraint annotation from the manager
- fixed instantation using the constraint and rely for it to set default values
- converted not yet converted constraint plugins

ParisLiakos’s picture

StatusFileSize
new14.9 KB
new721 bytes

There is actually a hook

$this->alterInfo('validation_constraint');

Also added some other stuff we typically add in annotations

fago’s picture

yes, there is hook - but no docs for it. Thus, if you add an @see, also add docs for the hook.

The last submitted patch, 28: d8_validatadtion_annotation.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 29: core-2195083-29-constraint-annotation.patch, failed testing.

ParisLiakos’s picture

Status: Needs work » Needs review
StatusFileSize
new1.95 KB
new16.85 KB

added the hook and some forgotten constraints

Status: Needs review » Needs work

The last submitted patch, 33: core_constraint-2195083-33.patch, failed testing.

ParisLiakos’s picture

Status: Needs work » Needs review
StatusFileSize
new634 bytes
new17.47 KB

one more

Status: Needs review » Needs work

The last submitted patch, 35: core_constraint-2195083-35.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new3.76 KB
new21.22 KB
les lim’s picture

Issue summary: View changes

Added beta evaluation.

xjm’s picture

Status: Needs review » Postponed

Postponing for the moment on #1966246-28: [meta] Introduce specific annotations for each plugin type; we can reactivate this issue once we have a decision there. Thanks!

xjm’s picture

Issue summary: View changes
Status: Postponed » Needs review

Unpostponing following the discussion on #1966246: [meta] Introduce specific annotations for each plugin type; we can go ahead with this issue during 8.0.x. Thanks!

xjm’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record

Oh, we probably need to update a change record though (or add one if it doesn't already exist). We can use the same change record for this and the other child issues.

les lim’s picture

Status: Needs work » Reviewed & tested by the community

Proposed change record for the whole meta: https://www.drupal.org/node/2484461

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 38: drupal_2195083_38.patch, failed testing.

Status: Needs work » Needs review

Les Lim queued 38: drupal_2195083_38.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 38: drupal_2195083_38.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new21.24 KB

Re-roll.

Status: Needs review » Needs work

The last submitted patch, 47: drupal_2195083_47.patch, failed testing.

les lim’s picture

Status: Needs work » Needs review
StatusFileSize
new21.85 KB
new625 bytes

Whoops, we missed a @Plugin implementation.

les lim’s picture

StatusFileSize
new23.16 KB
new1.31 KB

Blergh, I should've looked for others *before* uploading that. I found a few others with this:

grep -r "@Plugin" core/ | grep "Plugin/Validation/Constraint"

New patch and interdiff.

The last submitted patch, 49: core-2195083-Constraint_annotation-49.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 50: core-2195083-Constraint_annotation-50.patch, failed testing.

les lim’s picture

Status: Needs work » Needs review
StatusFileSize
new23.83 KB
new694 bytes

Chasing core.

xano’s picture

Status: Needs review » Needs work

Only nitpicks. The executable code looks good.

  1. +++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
    @@ -0,0 +1,59 @@
    + * Defines a validation constraint annotation object.
    

    Any class defines an object, really. This feels redundant and confusing. No real problem here, though.

  2. +++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
    @@ -0,0 +1,59 @@
    + * For a working example, see \Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint
    

    80-character limit.

  3. +++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
    @@ -0,0 +1,59 @@
    +   * The plugin ID usually resembles the class name without the "Constraint"
    +   * suffix.
    

    We shouldn't advise people on what to call their plugins, especially because the only requirement is that plugin IDs are prefixed.

  4. +++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
    @@ -0,0 +1,59 @@
    +   * @var \Drupal\Core\Annotation\Translation
    

    Should be @var string|\Drupal\ore\Annotation\Translation, because plain strings are allowed as well.

  5. +++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
    @@ -0,0 +1,59 @@
    +   * An array of data type IDs for which this constraint applies. Valid values
    

    Can we say plugin IDs just to be a little more specific as to what kind of IDs we mean?

  6. +++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
    @@ -0,0 +1,59 @@
    +  public $type = array();
    

    Let's be progressive and use the short array syntax ([]) here.

les lim’s picture

Status: Needs work » Needs review
StatusFileSize
new24.04 KB
new2.54 KB

Thanks, @Xano! Fixed #2 through #6. Also fixed a mismatched @file comment.

+++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
@@ -0,0 +1,59 @@
+ * Defines a validation constraint annotation object.

Any class defines an object, really. This feels redundant and confusing. No real problem here, though.

I think "object" is there to distinguish "annotation object" from just "annotation". In any case, I left this one as-is, since it's consistent with other annotation classes.

Status: Needs review » Needs work

The last submitted patch, 55: core-2195083-55-constraint_annotation.patch, failed testing.

les lim’s picture

Status: Needs work » Needs review

Testbot hiccuped.

xano’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Nice work. I don't think there's anything that would block an RTBC at this point.

+++ b/core/lib/Drupal/Core/Validation/Annotation/Constraint.php
@@ -40,20 +38,20 @@ class Constraint extends Plugin {
+   * An array of DataType plugin IDs for which this constraint applies. Valid

Why the capitalization?

les lim’s picture

That's how I encountered it in core.api.php ("DataType plugin"), referring specifically to the annotation name. But you can find it as both "DataType plugin" and "data type plugin" in various comments throughout the code base.

  • alexpott committed 3b62b84 on 8.0.x
    Issue #2195083 by Les Lim, ParisLiakos, Xano, gaurav_varshney, ravi....
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Yay the last of the non test plugins fixed - nice work. Committed 3b62b84 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the issue summary.

Status: Fixed » Closed (fixed)

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