Is the Email constraint on the Email Typed Data object declared correctly?

Created on 10 October 2018, over 5 years ago
Updated 26 February 2023, over 1 year ago

In reading the documentation on declaring Typed Data API data type plugins β†’ , it says the following:

constraints: An optional array of validation constraints. This is unused in default implementations of TypedData. It is preferred to add constraints to the data definition instance instead.

I'm assuming that 'default implementations of TypedData' refers to data type plugins provided by core. However, the data type plugin definition for the Email plugin declares the constraint in the plugin annotation.

These two items are at odds with each other. Either the documentation should be altered to remove the mention of this method being unused by core, or core should be altered to be in line with this documentation. I'm not sure which one is correct however, so I'm not sure where to proceed in rectifying this situation.

πŸ› Bug report
Status

Closed: outdated

Version

9.5

Component
PluginΒ  β†’

Last updated about 18 hours ago

Created by

πŸ‡¨πŸ‡¦Canada Jaypan

Live updates comments and jobs are added and updated live.
  • Documentation

    Primarily changes documentation, not code. For Drupal core issues, select the Documentation component instead of using this tag. In general, component selection is preferred over tag selection.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    The API page linked in the Issue Summary now contains an example that declares the constraint in the annotation. And that agrees with \Drupal\Core\TypedData\Annotation\DataType. so, I think this is outdated.

    Therefore, closing as outdated. If this is incorrect reopen the issue, by setting the status to 'Active', and add a comment explaining what still needs to be done.

    Thanks!

Production build 0.69.0 2024