Skip to content

Add validation constraints #2

@DieterHolvoet

Description

@DieterHolvoet

Summary

Add Symfony validation constraints.

Basic example

e.g. for when we're using custom request classes

<?php

namespace Drupal\module\Request;

use Drupal\wmrecaptcha\Plugin\Validation\Constraint as ReCaptcha;
use Symfony\Component\Validator\Constraints as Assert;

class SubmitApiRequest
{
    /**
     * @Assert\NotBlank
     * @ReCaptcha\Trusted
     */
    public string $reCaptchaToken;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions