You are here

ValidJSONConstraint.php in JSON Field 8

File

src/Plugin/Validation/Constraint/ValidJSONConstraint.php
View source
<?php

namespace Drupal\json_field\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * JSON Field valid JSON constraint.
 *
 * Verifies that input values are valid JSON.
 *
 * @Constraint(
 *   id = "valid_json",
 *   label = @Translation("Valid deserializable JSON text", context = "Validation")
 * )
 */
class ValidJSONConstraint extends Constraint {

  /**
   * The default violation message.
   *
   * @var string
   */
  public $message = 'The supplied text is not valid JSON data (@error).';

}

Classes

Namesort descending Description
ValidJSONConstraint JSON Field valid JSON constraint.