Validate hash using entity constraint instead of form validation

Created on 21 May 2025, 3 months ago

Problem/Motivation

Ideally, preventing duplicate redirects based on their hashes should be done using validation constraints, instead of form validation. This has two benefits.

  • Prevention will apply in other means of entity creation e.g. via APIs, imports via integrations of CSV files etc.
  • Customization is easier by applications by extending or overriding the validator.

Proposed resolution

Move validation to a constraint plugin.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡ͺPeru krystalcode

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @krystalcode
  • Status changed to Needs review 18 days ago
  • First commit to issue fork.
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    @krystalcode this is a really neat idea. +1 for moving validation out of forms and into constraints. I'm going to add some specific test coverage of constraint and check that we have and add if necessary coverage for the form.

    I've open an MR and merged this patch to do this.

  • Pipeline finished with Failed
    15 days ago
    Total: 224s
    #572924
  • Pipeline finished with Failed
    15 days ago
    Total: 232s
    #572930
  • Pipeline finished with Failed
    15 days ago
    Total: 196s
    #572970
  • Pipeline finished with Failed
    15 days ago
    Total: 181s
    #572983
  • Pipeline finished with Failed
    15 days ago
    Total: 186s
    #572986
  • Pipeline finished with Success
    15 days ago
    Total: 186s
    #573007
  • Pipeline finished with Success
    15 days ago
    Total: 180s
    #573014
  • Pipeline finished with Success
    15 days ago
    Total: 196s
    #573036
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Added unit test and paired the patch back to the minimum necessary change.

    I think this is a nice change that improves redirect validation and the ability to create redirects via an API.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Reviewed.

  • Pipeline finished with Success
    4 days ago
    Total: 204s
    #580882
  • Pipeline finished with Success
    4 days ago
    Total: 197s
    #580892
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    I've addressed @berdir's feedback - thanks for the review!

  • Pipeline finished with Success
    4 days ago
    Total: 588s
    #581287
  • Pipeline finished with Skipped
    4 days ago
    #581416
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Looks good now, simpler and fewer unrelated changes.

Production build 0.71.5 2024